use of me.dwliu.framework.integration.mybatis.plugin.CustomPaginationInterceptor in project ebase-boot by ebase-projects.
the class CustomMybatisPlusConfig method mybatisPlusInterceptor.
/**
* 新MybatisPlus插件配置
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(ObjectProvider<QueryInterceptor[]> queryInterceptors) {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 配置分页拦截器
CustomPaginationInterceptor paginationInterceptor = new CustomPaginationInterceptor();
// 配置自定义查询拦截器
QueryInterceptor[] queryInterceptorArray = queryInterceptors.getIfAvailable();
if (ObjectUtil.isNotEmpty(queryInterceptorArray)) {
AnnotationAwareOrderComparator.sort(queryInterceptorArray);
paginationInterceptor.setQueryInterceptors(queryInterceptorArray);
}
// 新分页
interceptor.addInnerInterceptor(paginationInterceptor);
return interceptor;
}
Aggregations