通用Mapper常用接口方法详解

1.Spring Boot 集成通用Mapper

<!--引入mybatis启动器-->
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.3.1</version>
</dependency>
<!--添加通用mapper组件-->
<dependency>
    <groupId>tk.mybatis</groupId>
    <artifactId>mapper-spring-boot-starter</artifactId>
    <version>1.1.4</version>
</dependency>

2.编写配置文件

#mapper
#mappers 多个接口时逗号隔开
mapper.mappers=tk.mybatis.mapper.common.Mapper
#insert和update中,是否判断字符串类型!=''
mapper.not-empty=false
#使用的数据库语言,通用mapper可以操作多种数据库
mapper.identity=MYSQL

3.编写接口继承Mapper接口操作即可

//User为自定义和数据库表对应的对象
interface UserMapper extends Mapper<User>,MySqlMapper<User>{

}

4.Mapper,MySqlMapper方法详解

1.MySqlMapper方法详解
在这里插入图片描述
2.Mapper方法详解:Mapper继承BaseMapper及ExampleMapper

                          ①BaseMapper

在这里插入图片描述

                          ②ExampleMapper

在这里插入图片描述

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值