pom配置
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.12</version>
</dependency>
- 使用yml
-
pagehelper: helper-dialect: mysql reasonable: true support-methods-arguments: true params: count=countSql
- 使用properties
-
#pagehelper分页插件配置 pagehelper.helper-dialect=mysql pagehelper.reasonable=true pagehelper.support-methods-arguments=true pagehelper.params=count=countSql
代码示例
-
//分页查询 public PageInfo<User> bookPageInfo(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); List<User> users = userMapper.getUsers(); PageInfo<User> PageInfo = new PageInfo<User>(users); return PageInfo; }