为什么我的不分页,一次返回所有数据
CategoryController.java
相关代码:
@Operation(summary ="后台目录列表") @PostMapping("admin/category/list") @ResponseBody public ApiRestResponse listCategoryForAdmin(@RequestParam Integer pageNum,@RequestParam Integer pageSize){ PageInfo pageInfo = categoryService.listForAdmin(pageNum,pageSize); return ApiRestResponse.success(pageInfo); }
CategoryServiceImpl.java
相关代码:
@Override public PageInfo listForAdmin(Integer pageNum, Integer pageSize){ PageHelper.startPage(pageNum,pageSize,"type,order_num"); List<Category> categoryList= categoryMapper.selectList(); PageInfo pageInfo = new PageInfo(categoryList); return pageInfo; }
CategoryMapper.java
List<Category> selectList();
CategoryMapper.xml
<select id="selectList" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from imooc_mall_category </select>
pom.xml:
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.13</version> </dependency>
代码如上,运行后
相关截图:
结果如下:
{
"status": 10000,
"msg": "SUCCESS",
"data": {
"total": 23,
"list": [
{
"id": 3,
"name": "新鲜水果",
"type": 1,
"parentId": 0,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T17:11:26.000+00:00"
},
{
"id": 4,
"name": "橘子橙子",
"type": 2,
"parentId": 3,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:10.000+00:00"
},
{
"id": 5,
"name": "海鲜水产",
"type": 1,
"parentId": 0,
"orderNum": 2,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:20.000+00:00"
},
{
"id": 6,
"name": "精选肉类",
"type": 1,
"parentId": 0,
"orderNum": 3,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:21.000+00:00"
},
{
"id": 7,
"name": "螃蟹",
"type": 2,
"parentId": 5,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:15.000+00:00"
},
{
"id": 8,
"name": "鱼类",
"type": 2,
"parentId": 5,
"orderNum": 2,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:16.000+00:00"
},
{
"id": 9,
"name": "冷饮冻食",
"type": 1,
"parentId": 0,
"orderNum": 4,
"createTime": "2019-12-20T13:45:28.000+00:00",
"updateTime": "2019-12-28T16:25:22.000+00:00"
},
{
"id": 10,
"name": "蔬菜蛋品",
"type": 1,
"parentId": 0,
"orderNum": 5,
"createTime": "2019-12-20T13:45:28.000+00:00",
"updateTime": "2019-12-28T16:25:23.000+00:00"
},
{
"id": 11,
"name": "草莓",
"type": 2,
"parentId": 3,
"orderNum": 2,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T15:44:42.000+00:00"
},
{
"id": 12,
"name": "奇异果",
"type": 2,
"parentId": 3,
"orderNum": 3,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:12.000+00:00"
},
{
"id": 13,
"name": "海参",
"type": 2,
"parentId": 5,
"orderNum": 3,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:17.000+00:00"
},
{
"id": 14,
"name": "车厘子",
"type": 2,
"parentId": 3,
"orderNum": 4,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:12.000+00:00"
},
{
"id": 15,
"name": "火锅食材",
"type": 2,
"parentId": 27,
"orderNum": 5,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2020-02-11T00:42:33.000+00:00"
},
{
"id": 16,
"name": "牛羊肉",
"type": 2,
"parentId": 6,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:18.000+00:00"
},
{
"id": 17,
"name": "冰淇淋",
"type": 2,
"parentId": 9,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:18.000+00:00"
},
{
"id": 18,
"name": "蔬菜综合",
"type": 2,
"parentId": 10,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2020-02-11T00:48:27.000+00:00"
},
{
"id": 19,
"name": "果冻橙",
"type": 3,
"parentId": 4,
"orderNum": 1,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2020-02-11T00:37:02.000+00:00"
},
{
"id": 27,
"name": "美味菌菇",
"type": 1,
"parentId": 0,
"orderNum": 7,
"createTime": "2019-12-20T13:45:28.000+00:00",
"updateTime": "2020-02-10T23:20:36.000+00:00"
},
{
"id": 28,
"name": "其他水果",
"type": 2,
"parentId": 3,
"orderNum": 4,
"createTime": "2019-12-18T01:17:00.000+00:00",
"updateTime": "2019-12-28T16:25:12.000+00:00"
},
{
"id": 29,
"name": "鸭货",
"type": 2,
"parentId": 8,
"orderNum": 12,
"createTime": "2023-04-25T19:11:48.000+00:00",
"updateTime": "2023-05-11T12:47:40.000+00:00"
},
{
"id": 30,
"name": "鸡肉",
"type": 2,
"parentId": 6,
"orderNum": 11,
"createTime": "2023-04-25T19:14:40.000+00:00",
"updateTime": "2023-04-25T19:14:40.000+00:00"
},
{
"id": 58,
"name": "xcvba",
"type": 3,
"parentId": 4,
"orderNum": 11,
"createTime": "2023-04-25T22:20:24.000+00:00",
"updateTime": "2023-04-25T22:20:24.000+00:00"
},
{
"id": 59,
"name": "xcba",
"type": 3,
"parentId": 2,
"orderNum": 11,
"createTime": "2023-04-25T23:44:27.000+00:00",
"updateTime": "2023-04-25T23:44:27.000+00:00"
}
],
"pageNum": 1,
"pageSize": 23,
"size": 23,
"startRow": 0,
"endRow": 22,
"pages": 1,
"prePage": 0,
"nextPage": 0,
"isFirstPage": true,
"isLastPage": true,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 8,
"navigatepageNums": [
1
],
"navigateFirstPage": 1,
"navigateLastPage": 1
}
}
问题描述:
运行后,所有数据表中所有数据都返回了,没有分页,所以内容23个目录内容全部返回了,又对照了一下视频没有发现哪里错。求助。
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星