pageHelper使用時的注意點


 

1 在pom.xml中導入相關的依賴(注意版本問題,報錯十有八九是因為版本問題)

        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.3</version>
        </dependency>    

2 在yml配置文件中輸入相關配置

pagehelper:
  helper-dialect: mysql
  reasonable: true
  support-methods-arguments: true
  params: count=countSql

3 使用 (個人推薦返回值為PageHelper方式)

3.1 返回page對象(注意,查詢語句必須緊跟着pagehelper語句,否則會報錯。 )

返回的為需要查詢的數據集合

3.2 返回pagehelper對象

返回的值為需要查詢的數據集合以及一系列分頁信息

 


免責聲明!

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



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