Search in sources :

Example 1 with CustomPaginationInterceptor

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;
}
Also used : CustomPaginationInterceptor(me.dwliu.framework.integration.mybatis.plugin.CustomPaginationInterceptor) QueryInterceptor(me.dwliu.framework.core.mybatis.interceptor.QueryInterceptor) MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) Bean(org.springframework.context.annotation.Bean)

Aggregations

MybatisPlusInterceptor (com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor)1 QueryInterceptor (me.dwliu.framework.core.mybatis.interceptor.QueryInterceptor)1 CustomPaginationInterceptor (me.dwliu.framework.integration.mybatis.plugin.CustomPaginationInterceptor)1 Bean (org.springframework.context.annotation.Bean)1