diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java index e0b5fdc8c4..5935e2b30b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java @@ -250,7 +250,7 @@ public class SchedulerController extends BaseController { @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryScheduleListPaging(@Parameter(hidden = true) @RequestAttribute(value = SESSION_USER) User loginUser, @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode, - @RequestParam long processDefinitionCode, + @RequestParam(value = "processDefinitionCode", required = false, defaultValue = "0") long processDefinitionCode, @RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java index 419f1151df..589d509ae0 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java @@ -568,16 +568,20 @@ public class SchedulerServiceImpl extends BaseServiceImpl implements SchedulerSe return result; } - ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); - if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { - log.error("Process definition does not exist, processDefinitionCode:{}.", processDefineCode); - putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); - return result; + if (processDefineCode != 0) { + ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefineCode); + if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { + log.error("Process definition does not exist, processDefinitionCode:{}.", processDefineCode); + putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); + return result; + } } Page page = new Page<>(pageNo, pageSize); + IPage schedulePage = - scheduleMapper.queryByProcessDefineCodePaging(page, processDefineCode, searchVal); + scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, projectCode, processDefineCode, + searchVal); List scheduleList = new ArrayList<>(); for (Schedule schedule : schedulePage.getRecords()) { diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java index 953fa35c47..8bf63269c2 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.java @@ -63,6 +63,20 @@ public interface ScheduleMapper extends BaseMapper { @Param("processDefinitionCode") long processDefinitionCode, @Param("searchVal") String searchVal); + /** + * scheduler page + * + * @param page page + * @param projectCode projectCode + * @param processDefinitionCode processDefinitionCode + * @param searchVal searchVal + * @return scheduler IPage + */ + IPage queryByProjectAndProcessDefineCodePaging(IPage page, + @Param("projectCode") long projectCode, + @Param("processDefinitionCode") long processDefinitionCode, + @Param("searchVal") String searchVal); + /** * Filter schedule * diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml index 86001a1fce..5c047fb3b3 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml @@ -44,6 +44,25 @@ order by s.update_time desc +