-
引入依赖
1 2 3 4 5
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.0</version> </dependency>
-
在application.yml中做如下配置
1 2 3 4 5 6
# 分页配置 pagehelper: helper-dialect: mysql reasonable: true support-methods-arguments: true params: count=countSql
-
在代码中使用
1 2 3 4
PageHelper.startPage(pageNum, pageSize); // 表示从pageNum页开始,每页pageSize条数据 List<Tools> list = toolsMapper.findAll(); PageInfo<Tools> pageInfo = new PageInfo<Tools>(list); return ServerResponse.createBySuccess("查询成功",pageInfo);
Post
Cancel
Spring Boot使用PageHelper
This post is licensed under
CC BY 4.0
by the author.