"增加已处理流程的高级搜索和排序功能"

This commit is contained in:
lijiaqi 2024-08-12 09:37:33 +08:00
parent 6b1231415a
commit 59cdb7988b
2 changed files with 49 additions and 11 deletions

View File

@ -286,7 +286,17 @@ public class WorkFlowController extends BaseController {
@ApiOperation(value = "已处理") @ApiOperation(value = "已处理")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "current", value = "当前页", dataType = "Integer"), @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( @ApiOperationSupport(
responses = @DynamicResponseParameters(properties = { responses = @DynamicResponseParameters(properties = {
@ -294,8 +304,13 @@ public class WorkFlowController extends BaseController {
}), }),
order = 13 order = 13
) )
public AjaxResult getDoneFlowList() { public AjaxResult getDoneFlowList(String value, String column, String orderBy, String type,
return workFlowService.getDoneFlowList(getPage()); 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);
} }
} }

View File

@ -519,18 +519,41 @@ public class WorkFlowService extends BaseService<WorkFlowMapper, WorkFlow> {
* 已处理的流程 * 已处理的流程
* *
* @param page * @param page
* @param value
* @param column
* @param orderBy
* @param type
* @param userId
* @param status
* @param startTime
* @param endTime
* @param deptId
* @param roleId
* @return * @return
*/ */
public AjaxResult getDoneFlowList(Page page) { 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) {
Page<WorkFlow> pageList = page(page, new QueryWrapper<WorkFlow>().lambda() QueryWrapper<WorkFlow> qw = new QueryWrapper<>();
// .eq(WorkFlow::getStatus, WorkFlowStatusEnum.ACTIVE.getStatus()) qw.lambda()
// .eq(WorkFlow::getStepType, WorkFlowStepTypeEnum.APPROVAL.getType()) .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( .exists(
"select 1 from t_work_flow_step_log step_log where t_work_flow.id = step_log.flow_id " + "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() + "'" " and step_log.user_id = '" + StpUtil.getLoginIdAsString() + "'"
) );
.orderByDesc(WorkFlow::getCreatedAt) 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<WorkFlow> pageList = page(page, qw);
return AjaxResult.ok().data(WorkFlowWrapper.INSTANCE.toDto(pageList)); return AjaxResult.ok().data(WorkFlowWrapper.INSTANCE.toDto(pageList));
} }
} }