1.确认导入的了maven依赖
2.在查询之前设置了page的相关参数
3.PageHelper.startPage 一定要写在查询语句的上面,因为他只管,他下面的第一条查询语句
`` PageHelper.startPage(graduationMonthSearchDto.getPageNum(), graduationMonthSearchDto.getPageSize());
List<GraduationMonthEntity> list = graduationMonthMapper.getList(graduationMonthSearchDto);
PageInfo<GraduationMonthEntity> pageInfo = new PageInfo<>(list);
return pageInfo;
下面两个包都要导入
在这里插入代码片
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
本文介绍如何在Java项目中使用PageHelper分页插件实现数据分页功能,包括配置Maven依赖、设置分页参数及正确调用startPage方法。
895

被折叠的 条评论
为什么被折叠?



