From 9f0089f15b320e9cfbe978ebe8551eb6e560ac5a Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Thu, 17 Dec 2020 22:27:26 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90db=E3=80=91=E6=9B=B4=E6=96=B0mp?= =?UTF-8?q?=E7=9A=84=E5=88=86=E9=A1=B5=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GunsMyBatisPlusAutoConfiguration.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/kernel-d-db/db-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/db/starter/GunsMyBatisPlusAutoConfiguration.java b/kernel-d-db/db-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/db/starter/GunsMyBatisPlusAutoConfiguration.java index b3ed4958f..f324bcd71 100644 --- a/kernel-d-db/db-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/db/starter/GunsMyBatisPlusAutoConfiguration.java +++ b/kernel-d-db/db-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/db/starter/GunsMyBatisPlusAutoConfiguration.java @@ -1,11 +1,12 @@ package cn.stylefeng.roses.kernel.db.starter; -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; -import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; -import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import cn.stylefeng.roses.kernel.db.mp.dbid.CustomDatabaseIdProvider; import cn.stylefeng.roses.kernel.db.mp.fieldfill.CustomMetaObjectHandler; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -16,9 +17,20 @@ import org.springframework.context.annotation.Configuration; * @date 2020/11/30 22:40 */ @Configuration -@AutoConfigureAfter(MybatisPlusAutoConfiguration.class) +@AutoConfigureBefore(MybatisPlusAutoConfiguration.class) public class GunsMyBatisPlusAutoConfiguration { + /** + * 新的分页插件 + */ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + // 使用分页插插件 + interceptor.addInnerInterceptor(paginationInterceptor()); + return interceptor; + } + /** * 分页插件 *