本文主要是介绍mybatis-plus分页无效问题解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
《mybatis-plus分页无效问题解决》本文主要介绍了mybatis-plus分页无效问题解决,原因是配置分页插件的版本问题,旧版本和新版本的MyBatis-Plus需要不同的分页配置,感兴趣的可...
昨天在做一www.chinasem.cn个新项目使用myBATis-plus分页一直失败,后来经过多方排查,确定问题并解决:
配置分页插件的问题
3.4.0版本分界线,不同版本的mybatis-plus需要的分页配置不同;
思路:
先查看自己项目mybatis-plus分页的依赖版本:
我的是这样的
<!--mybatis-plus--> www.chinasem.cn <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.3</version> <exclusions> <exclusion> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> </exclusion> <exclusion> <artifactId>jsqlparser</artifactId> <groupId>com.github.jsqlparser</groupId> </exclusion> </exclusions> </dependency>
旧版本(3.4.0之前)的分页插件配置
@Configuration public class MybatisPlusConfig { /** * 分页插件 */ @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } }
新版本(3.4.0之后)的分页插件配置
@Configuration public class MybatisPlusConfig { /** * mybatis-plus分页插件 */ @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.mysql)); return interceptor; } }
把这玩意搞好,问题解决,美汁儿之儿!!!!!!!!!!
到此这javascript篇关于mybatis-plus分页无效问题解决的文章就介绍到这了,更多相关mybatiBhGWsSs-plus分页无效内容请搜索China编程(www.chinasem.cn)以前的文章或继续浏览下面的China编程相关文章希望大家以后多多支持编程China编程(www.chinasem.cn)!
这篇关于mybatis-plus分页无效问题解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!