SmartMybatisPlusConfig.java 898 B

123456789101112131415161718192021222324252627
  1. package net.lab1024.smartadmin.config;
  2. import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
  4. import org.mybatis.spring.annotation.MapperScan;
  5. import org.springframework.context.annotation.Bean;
  6. import org.springframework.context.annotation.Configuration;
  7. import org.springframework.transaction.annotation.EnableTransactionManagement;
  8. /**
  9. * @author zhuoda
  10. */
  11. @EnableTransactionManagement
  12. @Configuration
  13. @MapperScan(basePackages = {"net.lab1024.smartadmin.module.*"})
  14. public class SmartMybatisPlusConfig {
  15. /**
  16. * 分页插件
  17. */
  18. @Bean
  19. public PaginationInterceptor paginationInterceptor() {
  20. // 开启 count 的 join 优化,只针对 left join !!!
  21. return new PaginationInterceptor().setCountSqlParser(new JsqlParserCountOptimize(true));
  22. }
  23. }