diff --git a/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java b/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java index bb10947..b694723 100644 --- a/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java +++ b/src/main/java/com/ydool/oa/workFlow/controller/WorkFlowController.java @@ -286,7 +286,17 @@ public class WorkFlowController extends BaseController { @ApiOperation(value = "已处理") @ApiImplicitParams({ @ApiImplicitParam(name = "current", value = "当前页", dataType = "Integer"), - @ApiImplicitParam(name = "size", value = "每页条数", dataType = "Integer") + @ApiImplicitParam(name = "size", value = "每页条数", dataType = "Integer"), + @ApiImplicitParam(name = "value", value = "搜索框中的内容(只支持字符串类型)"), + @ApiImplicitParam(name = "column", value = "排序字段 字段名"), + @ApiImplicitParam(name = "orderBy", value = "排序顺序 降序:desc,升序:asc"), + @ApiImplicitParam(name = "type", value = "流程类型"), + @ApiImplicitParam(name = "userId", value = "发起人"), + @ApiImplicitParam(name = "status", value = "状态"), + @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "Date"), + @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "Date"), + @ApiImplicitParam(name = "deptId", value = "部门id"), + @ApiImplicitParam(name = "roleId", value = "角色id") }) @ApiOperationSupport( responses = @DynamicResponseParameters(properties = { @@ -294,8 +304,13 @@ public class WorkFlowController extends BaseController { }), order = 13 ) - public AjaxResult getDoneFlowList() { - return workFlowService.getDoneFlowList(getPage()); + public AjaxResult getDoneFlowList(String value, String column, String orderBy, String type, + String userId, String status, @DateTimeFormat(pattern = "yyyy-MM-dd " + + "HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") LocalDateTime startTime, + @DateTimeFormat(pattern = "yyyy-MM-dd " + + "HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = + "GMT+8") LocalDateTime endTime, String deptId, String roleId) { + return workFlowService.getDoneFlowList(getPage(), value, column, orderBy, type, userId, status, startTime,endTime,deptId,roleId); } } diff --git a/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java b/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java index 46af81f..58aca64 100644 --- a/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java +++ b/src/main/java/com/ydool/oa/workFlow/service/WorkFlowService.java @@ -519,18 +519,41 @@ public class WorkFlowService extends BaseService { * 已处理的流程 * * @param page + * @param value + * @param column + * @param orderBy + * @param type + * @param userId + * @param status + * @param startTime + * @param endTime + * @param deptId + * @param roleId * @return */ - public AjaxResult getDoneFlowList(Page page) { - Page pageList = page(page, new QueryWrapper().lambda() -// .eq(WorkFlow::getStatus, WorkFlowStatusEnum.ACTIVE.getStatus()) -// .eq(WorkFlow::getStepType, WorkFlowStepTypeEnum.APPROVAL.getType()) + public AjaxResult getDoneFlowList(Page page, String value, String column, String orderBy, String type, String userId, String status, LocalDateTime startTime, LocalDateTime endTime, String deptId, String roleId) { + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda() + .eq(StrUtil.isNotBlank(value), WorkFlow::getData, value) + .eq(StrUtil.isNotBlank(status), WorkFlow::getStatus, status) + .eq(StrUtil.isNotBlank(type), WorkFlow::getType, type) + .eq(StrUtil.isNotBlank(userId), WorkFlow::getUserId, userId) + .ge(ObjUtil.isNotNull(startTime), WorkFlow::getCreatedAt, startTime) + .le(ObjUtil.isNotNull(endTime), WorkFlow::getCreatedAt, endTime) + .inSql(StrUtil.isNotBlank(deptId), WorkFlow::getUserId, "select id from t_sys_user where dept = '" + deptId + "'") + .inSql(StrUtil.isNotBlank(roleId), WorkFlow::getUserId, "select id from t_sys_user where roles like '%" + roleId + "%'") .exists( "select 1 from t_work_flow_step_log step_log where t_work_flow.id = step_log.flow_id " + - " and step_log.user_id = '" + StpUtil.getLoginIdAsString() + "'" - ) - .orderByDesc(WorkFlow::getCreatedAt) - ); + " and step_log.user_id = '" + StpUtil.getLoginIdAsString() + "'" + ); + if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) { + qw.orderByDesc(StrUtil.toUnderlineCase(column)); + } else if ("asc".equals(orderBy) && StrUtil.isNotBlank(column)) { + qw.orderByAsc(StrUtil.toUnderlineCase(column)); + } else { + qw.lambda().orderByDesc(WorkFlow::getCreatedAt); + } + Page pageList = page(page, qw); return AjaxResult.ok().data(WorkFlowWrapper.INSTANCE.toDto(pageList)); } }