pagehelper的失效问题

pagehelper是常用的分页插件,代码中常用到,使用简便且对代码侵入性较小,很多人都喜欢使用。不过有时会遇到分页失败问题,输出结果没有分页,日志输出sql语句没有分页关键字及分页参数,目测是pagehelper插件直接未起作用。此类情况总结起来一般是一下几种问题引起:

  • springboot项目中应导入的包pagehelper与springboot的整合包:
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
        </dependency>

直接用pagehelper的包可能无效:

        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
        </dependency>

 

  • pagehelper的分页作用范围是PageHelper.startPage();之后的第一个查询,其他查询无效

 

 

posted @ 2025-03-24 11:47  Marktowin  阅读(235)  评论(0)    收藏  举报