|
@@ -0,0 +1,24 @@
|
|
|
|
|
+package com.xuekairui.user.config;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * MyBatis-Plus 配置
|
|
|
|
|
+ */
|
|
|
|
|
+@Configuration
|
|
|
|
|
+public class MyBatisPlusConfig {
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分页拦截器
|
|
|
|
|
+ * 必须配置此拦截器,selectPage 才会执行 COUNT 查询,total 才会正确返回
|
|
|
|
|
+ */
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
|
|
|
+ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
|
|
|
|
+ interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
|
|
|
|
+ return interceptor;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|