安装

导入tkmybatis的maven路径

  1. <dependency>
  2. <groupId>tk.mybatis</groupId>
  3. <artifactId>mapper-spring-boot-starter</artifactId>
  4. <version>2.0.3-beta1</version>
  5. </dependency>

导入其他包

  1. <!--pagehelper-->
  2. <dependency>
  3. <groupId>com.github.pagehelper</groupId>
  4. <artifactId>pagehelper-spring-boot-starter</artifactId>
  5. <version>1.2.5</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>mysql</groupId>
  9. <artifactId>mysql-connector-java</artifactId>
  10. <scope>runtime</scope>
  11. </dependency>
  12. <!--druid依赖添加-->
  13. <dependency>
  14. <groupId>com.alibaba</groupId>
  15. <artifactId>druid-spring-boot-starter</artifactId>
  16. <version>1.1.10</version>
  17. </dependency>

使用

  1. public interface BaseMapper<T> extends Mapper<T>, MySqlMapper<T> {
  2. }
  3. 还有其他继承项:
  4. SqlServerMapperIdsMapperConditionMapper,但是我们一般继承
  5. MapperMySqlMapper足以满足我们日常单表操作的所有使用