• 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));
        }

  • 相关阅读:
    iceoryx源码阅读(四)——共享内存通信(二)
    学习自由模态试验的有限元仿真计算方法
    容灾恢复 | 记一次K8S集群中etcd数据快照的备份恢复实践
    KLOOK客路旅行基于Apache Hudi的数据湖实践
    分布式开源存储架构Ceph概述
    CC攻击的前身
    day17正则表达式作业
    k8s部署mysql报错‘/var/lib/mysql/‘: Operation not permitted
    【前端】前端监控⊆埋点
    qt creator 设置 项目依赖关系
  • 原文地址:https://blog.csdn.net/liaonanfeng88/article/details/126182176