TKMybatis使用方法:condition排序

condition.orderBy("updatedTime").desc();
@GetMapping("apply_list")
    @ApiOperation(value = "我的出差申请列表: status 1审批中,2审批通过,3审批拒绝")
    @ApiImplicitParams(
            @ApiImplicitParam(example = "[2,3]",name = "statusList",value = "statusList")
    )
    public ResultVO> list(
            HttpServletRequest request,
            @RequestParam(defaultValue = "1",required = false) Integer page,
            @RequestParam(defaultValue = "10",required = false) Integer size,
            String statusList
    ){
        Long userId = jwtTokenUtil.getUserIdFromToken(request);
        List statusList1 = JSONObject.parseArray(statusList, Integer.class);
        PageHelper.startPage(page, size);
        Condition condition = new Condition(BusinessTripApply.class);
        Example.Criteria criteria = condition.createCriteria();
        criteria.andEqualTo("tripperId",userId);
        criteria.andIn("status",statusList1);
        if (statusList1.contains(BusinessTripApplyStatusEnum.AUDIT_PASS.getCode()) ||
                statusList1.contains(BusinessTripApplyStatusEnum.AUDIT_REFUSE.getCode())){
            condition.orderBy("updatedTime").desc();
        }
        List businessTripApplyList = businessTripApplyService.selectByCondition(condition);
        PageInfo pageInfo = new PageInfo(businessTripApplyList);
        return ResultVOUtil.success(pageInfo);
    }

 

你可能感兴趣的:(TKMybatis使用方法:condition排序)