From a3bf10c88d63a27d0682834f8a81c0dc352f4907 Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Wed, 20 Apr 2022 14:53:40 +0800 Subject: [PATCH] [Feature][API] Refactor get dependent node information api (#9591) * feature_8922 * fix comment error * remove unused import * fix unused import --- .../ProcessDefinitionController.java | 43 +++++++ .../api/service/ProcessDefinitionService.java | 17 +++ .../impl/ProcessDefinitionServiceImpl.java | 54 +++++++++ .../main/resources/i18n/messages.properties | 110 +++++++++--------- .../resources/i18n/messages_en_US.properties | 2 + .../resources/i18n/messages_zh_CN.properties | 2 + .../entity/DependentProcessDefinition.java | 2 +- .../entity/DependentSimplifyDefinition.java | 63 ++++++++++ .../dao/mapper/ProcessDefinitionMapper.java | 10 ++ .../dao/mapper/ProcessTaskRelationMapper.java | 10 ++ .../dao/mapper/ProcessDefinitionMapper.xml | 13 +++ .../dao/mapper/ProcessTaskRelationMapper.xml | 10 ++ 12 files changed, 281 insertions(+), 55 deletions(-) create mode 100644 dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentSimplifyDefinition.java diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java index 5dba775317..909ba0fa09 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java @@ -566,6 +566,49 @@ public class ProcessDefinitionController extends BaseController { return returnDataList(result); } + /** + * get process definition list map by project code + * + * @param loginUser login user + * @param projectCode project code + * @return process definition list data + */ + @ApiOperation(value = "getProcessListByProjectCode", notes = "GET_PROCESS_LIST_BY_PROCESS_CODE_NOTES") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, type = "Long", example = "100") + }) + @GetMapping(value = "/query-process-definition-list") + @ResponseStatus(HttpStatus.OK) + @ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR) + public Result getProcessListByProjectCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode + ) { + Map result = processDefinitionService.queryProcessDefinitionListByProjectCode(projectCode); + return returnDataList(result); + } + + /** + * get task definition list by process definition code + * + * @param loginUser login user + * @param projectCode project code + * @return process definition list data + */ + @ApiOperation(value = "getTaskListByProcessDefinitionCode", notes = "GET_TASK_LIST_BY_PROCESS_CODE_NOTES") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, type = "Long", example = "100"), + @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100"), + }) + @GetMapping(value = "/query-task-definition-list") + @ResponseStatus(HttpStatus.OK) + @ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR) + public Result getTaskListByProcessDefinitionCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode, + @RequestParam(value = "processDefinitionCode") Long processDefinitionCode) { + Map result = processDefinitionService.queryTaskDefinitionListByProcessDefinitionCode(projectCode, processDefinitionCode); + return returnDataList(result); + } + /** * delete process definition by code * diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java index c58ca80043..a03b5cdbe6 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java @@ -296,6 +296,23 @@ public interface ProcessDefinitionService { */ Map queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode); + /** + * query process definition list by project code + * + * @param projectCode project code + * @return process definitions in the project + */ + Map queryProcessDefinitionListByProjectCode(long projectCode); + + /** + * query process definition list by project code + * + * @param projectCode project code + * @param processDefinitionCode process definition code + * @return process definitions in the project + */ + Map queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode); + /** * Encapsulates the TreeView structure * diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 682a6f6624..30b6307f85 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -43,6 +43,7 @@ import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState; +import org.apache.dolphinscheduler.dao.entity.DependentSimplifyDefinition; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.enums.UserType; @@ -101,6 +102,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -1419,6 +1421,58 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro return result; } + /** + * query process definition list by project code + * + * @param projectCode project code + * @return process definition list in the project + */ + @Override + public Map queryProcessDefinitionListByProjectCode(long projectCode) { + Map result = new HashMap<>(); + List processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null); + result.put(Constants.DATA_LIST, processDefinitions); + putMsg(result, Status.SUCCESS); + return result; + } + + /** + * query process definition list by process definition code + * + * @param projectCode project code + * @param processDefinitionCode process definition code + * @return task definition list in the process definition + */ + @Override + public Map queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode) { + Map result = new HashMap<>(); + + Set definitionCodesSet = new HashSet<>(); + definitionCodesSet.add(processDefinitionCode); + List processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet); + + //query process task relation + List processTaskRelations = processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode( + processDefinitions.get(0).getCode(), + processDefinitions.get(0).getVersion()); + + //query task definition log + List taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations); + + List taskDefinitionList = new ArrayList<>(); + for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) { + DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition(); + dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode()); + dependentSimplifyDefinition.setName(taskDefinitionLog.getName()); + dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion()); + taskDefinitionList.add(dependentSimplifyDefinition); + } + + result.put(Constants.DATA_LIST, taskDefinitionList); + putMsg(result, Status.SUCCESS); + return result; + } + /** * Encapsulates the TreeView structure * diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages.properties b/dolphinscheduler-api/src/main/resources/i18n/messages.properties index 26683adb1c..6bfcaf92cd 100644 --- a/dolphinscheduler-api/src/main/resources/i18n/messages.properties +++ b/dolphinscheduler-api/src/main/resources/i18n/messages.properties @@ -27,16 +27,16 @@ RUN_MODE=run mode TIMEOUT=timeout EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=execute action to process instance EXECUTE_TYPE=execute type -START_CHECK_PROCESS_DEFINITION_NOTES=start check process definition -GET_RECEIVER_CC_NOTES=query receiver cc +START_CHECK_PROCESS_DEFINITION_NOTES=start check process definition +GET_RECEIVER_CC_NOTES=query receiver cc DESC=description GROUP_NAME=group name GROUP_TYPE=group type -QUERY_ALERT_GROUP_LIST_NOTES=query alert group list -UPDATE_ALERT_GROUP_NOTES=update alert group -DELETE_ALERT_GROUP_BY_ID_NOTES=delete alert group by id -VERIFY_ALERT_GROUP_NAME_NOTES=verify alert group name, check alert group exist or not -GRANT_ALERT_GROUP_NOTES=grant alert group +QUERY_ALERT_GROUP_LIST_NOTES=query alert group list +UPDATE_ALERT_GROUP_NOTES=update alert group +DELETE_ALERT_GROUP_BY_ID_NOTES=delete alert group by id +VERIFY_ALERT_GROUP_NAME_NOTES=verify alert group name, check alert group exist or not +GRANT_ALERT_GROUP_NOTES=grant alert group USER_IDS=user id list ALERT_GROUP_TAG=alert group related operation ALERT_PLUGIN_INSTANCE_TAG=alert plugin instance related operation @@ -44,27 +44,27 @@ UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=update alert plugin instance operation CREATE_ALERT_PLUGIN_INSTANCE_NOTES=create alert plugin instance operation DELETE_ALERT_PLUGIN_INSTANCE_NOTES=delete alert plugin instance operation GET_ALERT_PLUGIN_INSTANCE_NOTES=get alert plugin instance operation -CREATE_ALERT_GROUP_NOTES=create alert group +CREATE_ALERT_GROUP_NOTES=create alert group WORKER_GROUP_TAG=worker group related operation SAVE_WORKER_GROUP_NOTES=create worker group WORKER_GROUP_NAME=worker group name WORKER_IP_LIST=worker ip list, eg. 192.168.1.1,192.168.1.2 QUERY_WORKER_GROUP_PAGING_NOTES=query worker group paging -QUERY_WORKER_GROUP_LIST_NOTES=query worker group list -DELETE_WORKER_GROUP_BY_ID_NOTES=delete worker group by id +QUERY_WORKER_GROUP_LIST_NOTES=query worker group list +DELETE_WORKER_GROUP_BY_ID_NOTES=delete worker group by id DATA_ANALYSIS_TAG=analysis related operation of task state -COUNT_TASK_STATE_NOTES=count task state +COUNT_TASK_STATE_NOTES=count task state COUNT_PROCESS_INSTANCE_NOTES=count process instance state -COUNT_PROCESS_DEFINITION_BY_USER_NOTES=count process definition by user -COUNT_COMMAND_STATE_NOTES=count command state +COUNT_PROCESS_DEFINITION_BY_USER_NOTES=count process definition by user +COUNT_COMMAND_STATE_NOTES=count command state COUNT_QUEUE_STATE_NOTES=count the running status of the task in the queue ACCESS_TOKEN_TAG=access token related operation MONITOR_TAG=monitor related operation MASTER_LIST_NOTES=master server list WORKER_LIST_NOTES=worker server list -QUERY_DATABASE_STATE_NOTES=query database state -QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE +QUERY_DATABASE_STATE_NOTES=query database state +QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE TASK_STATE=task instance state SOURCE_TABLE=SOURCE TABLE DEST_TABLE=dest table @@ -79,18 +79,18 @@ DATA_SOURCE_HOST=DATA SOURCE HOST DATA_SOURCE_PORT=data source port DATABASE_NAME=database name QUEUE_TAG=queue related operation -QUERY_QUEUE_LIST_NOTES=query queue list -QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging +QUERY_QUEUE_LIST_NOTES=query queue list +QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging CREATE_QUEUE_NOTES=create queue YARN_QUEUE_NAME=yarn(hadoop) queue name QUEUE_ID=queue id TENANT_DESC=tenant desc -QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging -QUERY_TENANT_LIST_NOTES=query tenant list -UPDATE_TENANT_NOTES=update tenant -DELETE_TENANT_NOTES=delete tenant +QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging +QUERY_TENANT_LIST_NOTES=query tenant list +UPDATE_TENANT_NOTES=update tenant +DELETE_TENANT_NOTES=delete tenant RESOURCES_TAG=resource center related operation -CREATE_RESOURCE_NOTES=create resource +CREATE_RESOURCE_NOTES=create resource RESOURCE_TYPE=resource file type RESOURCE_NAME=resource name RESOURCE_DESC=resource file desc @@ -99,29 +99,29 @@ RESOURCE_ID=resource id QUERY_RESOURCE_LIST_NOTES=query resource list DELETE_RESOURCE_BY_ID_NOTES=delete resource by id VIEW_RESOURCE_BY_ID_NOTES=view resource by id -ONLINE_CREATE_RESOURCE_NOTES=online create resource +ONLINE_CREATE_RESOURCE_NOTES=online create resource SUFFIX=resource file suffix CONTENT=resource file content UPDATE_RESOURCE_NOTES=edit resource file online DOWNLOAD_RESOURCE_NOTES=download resource file -CREATE_UDF_FUNCTION_NOTES=create udf function +CREATE_UDF_FUNCTION_NOTES=create udf function UDF_TYPE=UDF type FUNC_NAME=function name CLASS_NAME=package and class name ARG_TYPES=arguments UDF_DESC=udf desc -VIEW_UDF_FUNCTION_NOTES=view udf function -UPDATE_UDF_FUNCTION_NOTES=update udf function -QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging -VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name -DELETE_UDF_FUNCTION_NOTES=delete udf function -AUTHORIZED_FILE_NOTES=authorized file -UNAUTHORIZED_FILE_NOTES=unauthorized file -AUTHORIZED_UDF_FUNC_NOTES=authorized udf func -UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func -VERIFY_QUEUE_NOTES=verify queue +VIEW_UDF_FUNCTION_NOTES=view udf function +UPDATE_UDF_FUNCTION_NOTES=update udf function +QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging +VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name +DELETE_UDF_FUNCTION_NOTES=delete udf function +AUTHORIZED_FILE_NOTES=authorized file +UNAUTHORIZED_FILE_NOTES=unauthorized file +AUTHORIZED_UDF_FUNC_NOTES=authorized udf func +UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func +VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation -CREATE_TENANT_NOTES=create tenant +CREATE_TENANT_NOTES=create tenant TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password @@ -131,19 +131,19 @@ DATA_SOURCE_KERBEROS_KRB5_CONF=the kerberos authentication parameter java.securi DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=the kerberos authentication parameter login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=the kerberos authentication parameter login.user.keytab.path PROJECT_TAG=project related operation -CREATE_PROJECT_NOTES=create project +CREATE_PROJECT_NOTES=create project PROJECT_DESC=project description -UPDATE_PROJECT_NOTES=update project +UPDATE_PROJECT_NOTES=update project PROJECT_ID=project id QUERY_PROJECT_BY_ID_NOTES=query project info by project id -QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING -DELETE_PROJECT_BY_ID_NOTES=delete project by id +QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING +DELETE_PROJECT_BY_ID_NOTES=delete project by id QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project QUERY_ALL_PROJECT_LIST_NOTES=query all project list QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project QUERY_AUTHORIZED_USER_NOTES=query authorized user TASK_RECORD_TAG=task record related operation -QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging +QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging CREATE_TOKEN_NOTES=create access token for specified user UPDATE_TOKEN_NOTES=update access token for specified user TOKEN=access token string, it will be automatically generated when it absent @@ -159,11 +159,11 @@ RECEIVERS=receivers RECEIVERS_CC=receivers cc WORKER_GROUP_ID=worker server group id PROCESS_INSTANCE_PRIORITY=process instance priority -UPDATE_SCHEDULE_NOTES=update schedule +UPDATE_SCHEDULE_NOTES=update schedule SCHEDULE_ID=schedule id ONLINE_SCHEDULE_NOTES=online schedule -OFFLINE_SCHEDULE_NOTES=offline schedule -QUERY_SCHEDULE_NOTES=query schedule +OFFLINE_SCHEDULE_NOTES=offline schedule +QUERY_SCHEDULE_NOTES=query schedule QUERY_SCHEDULE_LIST_PAGING_NOTES=query schedule list paging LOGIN_TAG=User login related operations USER_NAME=user name @@ -198,7 +198,7 @@ PROCESS_INSTANCE_JSON=process instance info(json format) SCHEDULE_TIME=schedule time SYNC_DEFINE=update the information of the process instance to the process definition -RECOVERY_PROCESS_INSTANCE_FLAG=whether to recovery process instance +RECOVERY_PROCESS_INSTANCE_FLAG=whether to recovery process instance SEARCH_VAL=search val USER_ID=user id PAGE_SIZE=page size @@ -213,27 +213,27 @@ QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id TASK_ID=task instance id SKIP_LINE_NUM=skip line num -QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log +QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log USERS_TAG=users related operation SCHEDULER_TAG=scheduler related operation -CREATE_SCHEDULE_NOTES=create schedule +CREATE_SCHEDULE_NOTES=create schedule CREATE_USER_NOTES=create user TENANT_ID=tenant id QUEUE=queue EMAIL=email PHONE=phone -QUERY_USER_LIST_NOTES=query user list +QUERY_USER_LIST_NOTES=query user list UPDATE_USER_NOTES=update user DELETE_USER_BY_ID_NOTES=delete user by id -GRANT_PROJECT_NOTES=GRANT PROJECT +GRANT_PROJECT_NOTES=GRANT PROJECT PROJECT_IDS=project ids(string format, multiple projects separated by ",") GRANT_PROJECT_BY_CODE_NOTES=GRANT PROJECT BY CODE REVOKE_PROJECT_NOTES=REVOKE PROJECT FOR USER PROJECT_CODE=project code GRANT_RESOURCE_NOTES=grant resource file RESOURCE_IDS=resource ids(string format, multiple resources separated by ",") -GET_USER_INFO_NOTES=get user info +GET_USER_INFO_NOTES=get user info LIST_USER_NOTES=list user VERIFY_USER_NAME_NOTES=verify user name UNAUTHORIZED_USER_NOTES=cancel authorization @@ -241,12 +241,12 @@ ALERT_GROUP_ID=alert group id AUTHORIZED_USER_NOTES=authorized user GRANT_UDF_FUNC_NOTES=grant udf function UDF_IDS=udf ids(string format, multiple udf functions separated by ",") -GRANT_DATASOURCE_NOTES=grant datasource +GRANT_DATASOURCE_NOTES=grant datasource DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",") QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=query process instance global variables and local variables -VIEW_GANTT_NOTES=view gantt +VIEW_GANTT_NOTES=view gantt SUB_PROCESS_INSTANCE_ID=sub process instance id TASK_NAME=task instance name TASK_INSTANCE_TAG=task instance related operation @@ -262,9 +262,9 @@ DATA_SOURCE_ID=DATA SOURCE ID QUERY_DATA_SOURCE_NOTES=query data source by id QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=query data source list by database type QUERY_DATA_SOURCE_LIST_PAGING_NOTES=query data source list paging -CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE -CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test -DELETE_DATA_SOURCE_NOTES=delete data source +CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE +CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test +DELETE_DATA_SOURCE_NOTES=delete data source VERIFY_DATA_SOURCE_NOTES=verify data source UNAUTHORIZED_DATA_SOURCE_NOTES=unauthorized data source AUTHORIZED_DATA_SOURCE_NOTES=authorized data source @@ -299,3 +299,5 @@ OPERATION_TYPE=operation type TASK_DEFINITION_TAG=task definition related operation PROCESS_TASK_RELATION_TAG=process task relation related operation ENVIRONMENT_TAG=environment related operation +GET_PROCESS_LIST_BY_PROCESS_CODE_NOTES=query process definition list by project code +GET_TASK_LIST_BY_PROCESS_CODE_NOTES=query task definition list by process definition code \ No newline at end of file diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties b/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties index bdaba338d1..39bc227a21 100644 --- a/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties +++ b/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties @@ -358,3 +358,5 @@ OPERATION_TYPE=operation type TASK_DEFINITION_TAG=task definition related operation PROCESS_TASK_RELATION_TAG=process task relation related operation ENVIRONMENT_TAG=environment related operation +GET_PROCESS_LIST_BY_PROCESS_CODE_NOTES=query process definition list by project code +GET_TASK_LIST_BY_PROCESS_CODE_NOTES=query task definition list by process definition code \ No newline at end of file diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties b/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties index 748f2a662d..1e779863c6 100644 --- a/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties +++ b/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties @@ -355,3 +355,5 @@ OPERATION_TYPE=操作类型 TASK_DEFINITION_TAG=任务定义相关操作 PROCESS_TASK_RELATION_TAG=工作流关系相关操作 ENVIRONMENT_TAG=环境相关操作 +GET_PROCESS_LIST_BY_PROCESS_CODE_NOTES=通过项目代码查询工作流定义 +GET_TASK_LIST_BY_PROCESS_CODE_NOTES=通过工作流定义代码查询任务定义 \ No newline at end of file diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentProcessDefinition.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentProcessDefinition.java index 109a6f7e2b..9de57dff33 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentProcessDefinition.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentProcessDefinition.java @@ -110,7 +110,7 @@ public class DependentProcessDefinition { return this.processDefinitionName; } - public void setprocessDefinitionName(String name) { + public void setProcessDefinitionName(String name) { this.processDefinitionName = name; } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentSimplifyDefinition.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentSimplifyDefinition.java new file mode 100644 index 0000000000..bc33b9d846 --- /dev/null +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DependentSimplifyDefinition.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dolphinscheduler.dao.entity; + +/** + * dependent node simplify definition + */ +public class DependentSimplifyDefinition { + + /** + * definition code + */ + private Long code; + + /** + * definition name + */ + private String name; + + /** + * definition version + */ + private Integer version; + + public Long getCode() { + return this.code; + } + + public void setCode(Long code) { + this.code = code; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getVersion() { + return this.version; + } + + public void setVersion(Integer version) { + this.version = version; + } +} diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.java index c8bd196936..35fbfe2918 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.java @@ -18,6 +18,7 @@ package org.apache.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; +import org.apache.dolphinscheduler.dao.entity.DependentSimplifyDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.ibatis.annotations.MapKey; @@ -124,6 +125,15 @@ public interface ProcessDefinitionMapper extends BaseMapper { */ List queryAllDefinitionList(@Param("projectCode") long projectCode); + /** + * query process definition list + * + * @param projectCode projectCode + * @return process definition list + */ + List queryDefinitionListByProjectCodeAndProcessDefinitionCodes(@Param("projectCode") long projectCode, + @Param("codes") Collection codes); + /** * query process definition by ids * diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java index c14f4b4db8..4332b54960 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java @@ -124,6 +124,16 @@ public interface ProcessTaskRelationMapper extends BaseMapper queryUpstreamByCodes(@Param("projectCode") long projectCode, @Param("taskCode") long taskCode, @Param("preTaskCodes") Long[] preTaskCodes); + /** + * query process task relation by process definition code + * + * @param processDefinitionCode process definition code + * @param processDefinitionVersion process definition version + * @return ProcessTaskRelation + */ + List queryProcessTaskRelationsByProcessDefinitionCode(@Param("processDefinitionCode") long processDefinitionCode, + @Param("processDefinitionVersion") Integer processDefinitionVersion); + /** * count upstream by codes * diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml index d5117aa734..7ac596ea3c 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml @@ -94,6 +94,19 @@ where project_code = #{projectCode} order by create_time desc + + + update t_ds_process_task_relation