Browse Source

fix query issue when update environment (#9752)

3.0.0/version-upgrade
Tq 3 years ago committed by GitHub
parent
commit
8b3984b20e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java

9
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) { private Map<String, Object> checkUsedEnvironmentWorkerGroupRelation(Set<String> deleteKeySet,String environmentName, Long environmentCode) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
for (String workerGroup : deleteKeySet) { for (String workerGroup : deleteKeySet) {
TaskDefinition taskDefinition = taskDefinitionMapper List<TaskDefinition> taskDefinitionList = taskDefinitionMapper
.selectOne(new QueryWrapper<TaskDefinition>().lambda() .selectList(new QueryWrapper<TaskDefinition>().lambda()
.eq(TaskDefinition::getEnvironmentCode,environmentCode) .eq(TaskDefinition::getEnvironmentCode,environmentCode)
.eq(TaskDefinition::getWorkerGroup,workerGroup)); .eq(TaskDefinition::getWorkerGroup,workerGroup));
if (Objects.nonNull(taskDefinition)) { if (Objects.nonNull(taskDefinitionList) && taskDefinitionList.size() != 0) {
putMsg(result, Status.UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR,workerGroup,environmentName,taskDefinition.getName()); 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; return result;
} }
} }

Loading…
Cancel
Save