pagehelper超過頁數仍然可以查出數據


spring boot中pageHelper的使用

  • pom文件中添加
 <!--pagehelper --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.1.1</version> </dependency> 
  • application.properties中添加如下配置
pagehelper.helperDialect=sqlserver
pagehelper.reasonable=false pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql

其中pagehelper.reasonable這個屬性含義是分頁參數合理化,3.3.0以上版本可用。默認值為false,但是養成良好習慣,對於自己用到的配置,就算有默認值,也重新寫。防止因為版本的變化,導致默認值有變化。
當啟用合理化時,如果pageNum>pageSize,默認會查詢最后一頁的數據。禁用合理化后,當pageNum>pageSize會返回空數據


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM