mybatis-plus分页列表 查询 倒序排列从大到小

mybatis-plus分页列表 查询 倒序排列从大到小

@ApiOperation(value="积分排行榜-分页列表查询", notes="积分排行榜-分页列表查询")
   @GetMapping(value = "/list")
   public Result<IPage<DietCharts>> queryPageList(DietCharts dietCharts,
                                  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                  HttpServletRequest req) {
       QueryWrapper<DietCharts> queryWrapper = QueryGenerator.initQueryWrapper(dietCharts, req.getParameterMap());
       Page<DietCharts> page = new Page<DietCharts>(pageNo, pageSize);
       queryWrapper.orderByDesc("sign_in_points");
       List<DietCharts> list = dietChartsService.list(queryWrapper);
       Collections.sort(list, (o1, o2) -> o2.getSignInPoints().compareTo(o1.getSignInPoints()));
       Page<DietCharts> pageResult = new Page<>(pageNo, pageSize, page.getTotal());
       pageResult.setRecords(list);
       IPage<DietCharts> pageList = pageResult;
//       IPage pageList = dietChartsService.selectList(pageNo,pageSize,dietCharts);
       return Result.OK(pageList);
   }

你可能感兴趣的:(Java开发,mybatis,java,开发语言)