You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ca...@apache.org on 2022/04/25 09:46:43 UTC

[dolphinscheduler] branch dev updated: fix query issue when update environment (#9752)

This is an automated email from the ASF dual-hosted git repository.

caishunfeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 8b3984b20e fix query issue when update environment (#9752)
8b3984b20e is described below

commit 8b3984b20e1e68b8c082693c6a7a8e0f39e82753
Author: Tq <ti...@gmail.com>
AuthorDate: Mon Apr 25 17:46:36 2022 +0800

    fix query issue when update environment (#9752)
---
 .../api/service/impl/EnvironmentServiceImpl.java                 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
index 61fee25992..9734869633 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java
@@ -425,13 +425,14 @@ public class EnvironmentServiceImpl extends BaseServiceImpl implements Environme
     private Map<String, Object> checkUsedEnvironmentWorkerGroupRelation(Set<String> deleteKeySet,String environmentName, Long environmentCode) {
         Map<String, Object> result = new HashMap<>();
         for (String workerGroup : deleteKeySet) {
-            TaskDefinition taskDefinition = taskDefinitionMapper
-                    .selectOne(new QueryWrapper<TaskDefinition>().lambda()
+            List<TaskDefinition> taskDefinitionList = taskDefinitionMapper
+                    .selectList(new QueryWrapper<TaskDefinition>().lambda()
                             .eq(TaskDefinition::getEnvironmentCode,environmentCode)
                             .eq(TaskDefinition::getWorkerGroup,workerGroup));
 
-            if (Objects.nonNull(taskDefinition)) {
-                putMsg(result, Status.UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR,workerGroup,environmentName,taskDefinition.getName());
+            if (Objects.nonNull(taskDefinitionList) && taskDefinitionList.size() != 0) {
+                Set<String> collect = taskDefinitionList.stream().map(TaskDefinition::getName).collect(Collectors.toSet());
+                putMsg(result, Status.UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR,workerGroup,environmentName, collect);
                 return result;
             }
         }