安装
导入tkmybatis的maven路径
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.0.3-beta1</version>
</dependency>
导入其他包
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!--druid依赖添加-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
使用
public interface BaseMapper<T> extends Mapper<T>, MySqlMapper<T> {
}
还有其他继承项:
SqlServerMapper,IdsMapper,ConditionMapper,但是我们一般继承
Mapper和MySqlMapper足以满足我们日常单表操作的所有使用