• springboot使用pagehelper分页失效场景


    现象:使用分页查时都是全量数据,没有limit,count

    原因1:如果你是是引用以下依赖:

           
                com.github.pagehelper
                pagehelper
                5.1.8
           

    更替为

           
                com.github.pagehelper
                pagehelper-spring-boot-starter
                1.2.10
           
     

     yml添加:

    #pagehelper分页插件配置
    pagehelper:
     helperDialect: mysql
     reasonable: true
     supportMethodsArguments: true
     params: count=countSql
    

    然后可能还是报错。

    原因2:依赖冲突

    所以排除相关包,即:

            
                com.github.pagehelper
                pagehelper-spring-boot-starter
                1.2.10
                
                    
                        org.mybatis
                        mybatis
                    
                    
                        org.mybatis
                        mybatis-spring
                    
                    
                        org.apache.logging.log4j
                        log4j-slf4j-impl
                    
                    
                        slf4j-api
                        org.slf4j
                    
                    
                        logback-classic
                        ch.qos.logback
                    
                    
                        log4j-over-slf4j
                        org.slf4j
                    
                    
                        jul-to-slf4j
                        org.slf4j
                    
                    
                        spring-boot-starter-logging
                        org.springframework.boot
                    
                
            
    

        @GetMapping("findByAllwithPage")
        public PageInfo findByAllwithPage(int page, int pageSize, xx xx) {
            PageHelper.startPage(page, pageSize);
            return new PageInfo<>(xx.findByAll(xx));
        }

  • 相关阅读:
    【ARM-0】基本概念
    C语言十六弹 --求两个整数二进制位不同的位数
    React_react入门
    计算机毕业设计Java校园摄影爱好者交流网站(源码+系统+mysql数据库+Lw文档)
    debian 9 ssh root权限登录
    Leetcode—283.移动零【简单】
    HTML那些重要的知识点
    SpringBoot 统一登录鉴权、异常处理、数据格式
    【深度学习】(3) Transformer 中的 Encoder 机制,附Pytorch完整代码
    AOP实现系统告警
  • 原文地址:https://blog.csdn.net/liaonanfeng88/article/details/126182176