依赖
com.github.pagehelper pagehelper-spring-boot-starter1.2.10
在select语句之前,调用PageHelper.startPage(页码,每页行数)
@Override public PageInfoqueryLimit(int limit, int rows, String name) { //1.limit:第几页 rows:每页显示的记录数 PageHelper.startPage(limit, rows); //2.查询 *** 作 List studentList = crudDao.queryLimit(name); //3.PageInfo详细信息 PageInfo pageInfo = new PageInfo (studentList); return pageInfo; }
输出信息:
{ "total": 80, "list": [ { "id": 5, "name": "ssfasd", "email": "fasdfa@qq.com", "age": 18 }, { "id": 6, "name": "展示", "email": "a@foxmail.com", "age": 1 } ], "pageNum": 3, "pageSize": 2, "size": 2, "startRow": 5, "endRow": 6, "pages": 40, "prePage": 2, "nextPage": 4, "isFirstPage": false, "isLastPage": false, "hasPreviousPage": true, "hasNextPage": true, "navigatePages": 8, "navigatepageNums": [ 1, 2, 3, 4, 5, 6, 7, 8 ], "navigateFirstPage": 1, "navigateLastPage": 8 }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)