mybatis-plus
介绍
(简称 MP)是一个 MyBatis (opens new window)的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发、提高效率而生。
官方网址
https://baomidou.com/
MAVEN
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.5.1</version>
</dependency>
配置文件
# 显示sql日志配置
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
通用Mapper
在对应mapper中集成 BaseMapper
通用Service
MP中接口:IService ,实现类 :ServiceImpl
JAVA标签
//原始写法
@select ("")
//带一个参数的,等于
@Select("select * from 表名 where 字段 = #{xxxx}")
//like
@Select("select * from 表名 where 字段 like \"%\" #{xxxx} \"%\"")