配置类
@Configuration
@MapperScan({"com.calm.encode.mapper"})
public class MybatisPlusConfig {
@Value("${system.mybatis.over-flow}")
private boolean overFlow;
/**
* @Description : mybatis-plus分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
paginationInterceptor.setOverflow(overFlow);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInterceptor.setLimit(30);
return paginationInterceptor;
}
/**
* 乐观锁 插件
* @return
*/
@Bean
public OptimisticLockerInterceptor optimisticLoker() {
return new OptimisticLockerInterceptor();
}
}