|
@@ -0,0 +1,33 @@
|
|
|
+package com.yonge.toolset.mybatis.config;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
|
|
|
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.context.annotation.Primary;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author hgw
|
|
|
+ * Created by 2021-12-02
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+public class MyBatisPlusConfig {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MybatisPlusProperties plusProperties;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页插件
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ @Primary
|
|
|
+ public PaginationInterceptor paginationInterceptor() {
|
|
|
+ MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
|
|
|
+ mybatisConfiguration.setMapUnderscoreToCamelCase(true);
|
|
|
+ mybatisConfiguration.setCacheEnabled(false);
|
|
|
+ plusProperties.setConfiguration(mybatisConfiguration);
|
|
|
+ return new PaginationInterceptor();
|
|
|
+ }
|
|
|
+}
|