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对象

返回的值为需要查询的数据集合以及一系列分页信息

原文地址:https://www.cnblogs.com/cl-rr/p/9638711.html