/** * 分页查询 * @param page * @param pageSize * @return */ @GetMapping("/page") public R<Page> page(int page,int pageSize){ //分页构造器,前端网址最后是page和pageInfo Page<Category> pageInfo = new Page<>(page,pageSize); //条件构造器 LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<>(); //添加排序条件,根据sort进行排序 //实体类里面有sort字段 queryWrapper.orderByAsc(Category::getSort); //分页查询 categoryService.page(pageInfo,queryWrapper); return R.success(pageInfo); }
标签:queryWrapper,分页,pageSize,分类,page,查询,pageInfo From: https://www.cnblogs.com/dahuilang21/p/17246530.html