Mybatis-Plus
依赖:<mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
<!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatisplus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>${mybatisplus.version}</version>
</dependency>
application.properties
mybatis-plus.mapper-locations=classpath*:mybatis/mapper/**/*Mapper.xml
mybatis-plus.type-aliases-package=cn.com.agree.**.domain
mybatis-plus.global-config.banner=false
mybatis-plus.global-config.db-config.id-type=assign_id
#字段策略
mybatis-plus.global-config.db-config.insert-strategy=not_null
mybatis-plus.global-config.db-config.update-strategy=not_null
mybatis-plus.global-config.db-config.select-strategy=not_empty
#驼峰下划线转换
mybatis-plus.global-config.db-config.table-underline=false
#逻辑删除全局值(1表示已删除,这也是Mybatis Plus的默认配置)
mybatis-plus.global-config.db-config.logic-delete-value=1
#逻辑未删除全局值(0表示未删除,这也是Mybatis Plus的默认配置)
mybatis-plus.global-config.db-config.logic-not-delete-value=0
#驼峰下划线转换
mybatis-plus.global-config.configuration.map-underscore-to-camel-case=false
#二级缓存
mybatis-plus.global-config.configuration.cache-enabled=false
#mybatis-plus配置控制台打印完整带参数SQL语句
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
MybatisPlusConfiguration
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
@EnableTransactionManagement
@MapperScan("cn.com.agma.mapper")
@Configuration
public class MybatisPlusConfiguration {
}