PageHelper分页插件
pom.xml 文件中添加 PageHelper 依赖包
com.github.pagehelper
pagehelper
5.1.4
文档:
https://pagehelper.github.io/docs/
在Spring 配置文件中,配置拦截器插件
helpDialect=mysql
reasonable=true
项目中使用方法和结果
在配置完mybatis后,我简单的说下pagehelper的业务用法,就以分页查询用户列表为例。
添加查询所以用户的mapper接口,对应的sql语句我就不写了。
List listUser();
重点来了,然后在service中,先开启分页,然后把查询结果集放入PageInfo中:
public PageInfo listUserByPage(int pageNum, int pageSize) {
<