use of org.springblade.core.mp.plugins.BladePaginationInterceptor in project blade-tool by chillzhuang.
the class MybatisPlusConfiguration method mybatisPlusInterceptor.
/**
* mybatis-plus 拦截器集合
*/
@Bean
@ConditionalOnMissingBean(MybatisPlusInterceptor.class)
public MybatisPlusInterceptor mybatisPlusInterceptor(ObjectProvider<QueryInterceptor[]> queryInterceptors, TenantLineInnerInterceptor tenantLineInnerInterceptor, MybatisPlusProperties mybatisPlusProperties) {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 配置租户拦截器
interceptor.addInnerInterceptor(tenantLineInnerInterceptor);
// 配置分页拦截器
BladePaginationInterceptor paginationInterceptor = new BladePaginationInterceptor();
// 配置自定义查询拦截器
QueryInterceptor[] queryInterceptorArray = queryInterceptors.getIfAvailable();
if (ObjectUtil.isNotEmpty(queryInterceptorArray)) {
AnnotationAwareOrderComparator.sort(queryInterceptorArray);
paginationInterceptor.setQueryInterceptors(queryInterceptorArray);
}
paginationInterceptor.setMaxLimit(mybatisPlusProperties.getPageLimit());
paginationInterceptor.setOverflow(mybatisPlusProperties.getOverflow());
interceptor.addInnerInterceptor(paginationInterceptor);
return interceptor;
}
Aggregations