From 5d4fcb3739a698f8d88ccdabb219efa915e06c45 Mon Sep 17 00:00:00 2001 From: Jiajie Zhong Date: Wed, 25 May 2022 14:23:59 +0800 Subject: [PATCH 1/2] [Fix] Task group queue query all list error Add support query all task queue by not given specific groupId close: #10102 --- .../api/controller/TaskGroupController.java | 17 ++++++--- .../api/service/TaskGroupQueueService.java | 11 +++--- .../dao/mapper/TaskGroupQueueMapper.xml | 36 ++++++++++--------- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java index 87977b3638b0..a71a7c956009 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java @@ -297,14 +297,21 @@ public Result modifyPriority(@ApiIgnore @RequestAttribute(value = Constants.SESS /** * query task group queue list paging * - * @param loginUser login user - * @param pageNo page number - * @param pageSize page size + * @param groupId ID for task group + * @param taskName Task Name + * @param processName Process instance name + * @param status Task queue status + * @param loginUser login user + * @param pageNo page number + * @param pageSize page size * @return queue list */ @ApiOperation(value = "queryTasksByGroupId", notes = "QUERY_ALL_TASKS_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "groupId", value = "GROUP_ID", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "groupId", value = "GROUP_ID", required = false, dataType = "Int", example = "1", defaultValue = "-1"), + @ApiImplicitParam(name = "taskInstanceName", value = "TASK_INSTANCE_NAME", required = false, dataType = "String", example = "taskName"), + @ApiImplicitParam(name = "processInstanceName", value = "PROCESS_INSTANCE_NAME", required = false, dataType = "String", example = "processName"), + @ApiImplicitParam(name = "status", value = "STATUS", required = false, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @@ -313,7 +320,7 @@ public Result modifyPriority(@ApiIgnore @RequestAttribute(value = Constants.SESS @ApiException(QUERY_TASK_GROUP_QUEUE_LIST_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryTasksByGroupId(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam("groupId") Integer groupId, + @RequestParam(value= "groupId", required = false, defaultValue = "-1") Integer groupId, @RequestParam(value = "taskInstanceName",required = false) String taskName, @RequestParam(value = "processInstanceName",required = false) String processName, @RequestParam(value = "status",required = false) Integer status, diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskGroupQueueService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskGroupQueueService.java index 651267ebb2d4..e6e81d950b11 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskGroupQueueService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskGroupQueueService.java @@ -28,10 +28,13 @@ public interface TaskGroupQueueService { /** * query tasks in task group queue by group id - * @param loginUser login user - * @param groupId group id - * @param pageNo page no - * @param pageSize page size + * @param loginUser login user + * @param groupId group id + * @param taskName Task Name + * @param processName Process instance name + * @param status Task queue status + * @param pageNo page no + * @param pageSize page size * @return tasks list */ diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupQueueMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupQueueMapper.xml index a780270bfdf0..5eacbea9b8f1 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupQueueMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskGroupQueueMapper.xml @@ -134,22 +134,26 @@ left join t_ds_process_definition p_f on process.process_definition_code = p_f.code and process.process_definition_version = p_f.version join t_ds_project as p on p_f.project_code = p.code - where queue.group_id = #{groupId} - - and task_name like concat('%', #{taskName}, '%') - - - and process.name like concat('%', #{processName}, '%') - - - and queue.status =#{status} - - - and p.code in - - #{i.code} - - + + + queue.group_id = #{groupId} + + + and task_name like concat('%', #{taskName}, '%') + + + and process.name like concat('%', #{processName}, '%') + + + and queue.status =#{status} + + + and p.code in + + #{i.code} + + + order by queue.update_time desc From 6c367b2d0f864f11f9ea8e2bbc3c5d7fb29f711f Mon Sep 17 00:00:00 2001 From: Jiajie Zhong Date: Wed, 25 May 2022 14:25:26 +0800 Subject: [PATCH 2/2] add space between key-val pair --- .../dolphinscheduler/api/controller/TaskGroupController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java index a71a7c956009..ca65ac78fe8a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskGroupController.java @@ -320,7 +320,7 @@ public Result modifyPriority(@ApiIgnore @RequestAttribute(value = Constants.SESS @ApiException(QUERY_TASK_GROUP_QUEUE_LIST_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryTasksByGroupId(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value= "groupId", required = false, defaultValue = "-1") Integer groupId, + @RequestParam(value = "groupId", required = false, defaultValue = "-1") Integer groupId, @RequestParam(value = "taskInstanceName",required = false) String taskName, @RequestParam(value = "processInstanceName",required = false) String processName, @RequestParam(value = "status",required = false) Integer status,