From 59cdb7988b69147d53b0273805d3fe34c50b50b0 Mon Sep 17 00:00:00 2001 From: lijiaqi Date: Mon, 12 Aug 2024 09:37:33 +0800 Subject: [PATCH] =?UTF-8?q?"=E5=A2=9E=E5=8A=A0=E5=B7=B2=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=9A=84=E9=AB=98=E7=BA=A7=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=92=8C=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WorkFlowController.java | 21 ++++++++-- .../oa/workFlow/service/WorkFlowService.java | 39 +++++++++++++++---- 2 files changed, 49 insertions(+), 11 deletions(-) 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)); } }