Browse Source

[Fix-8056] Rectify this issue about failing to edit worker groups for an environment. (#8072) (#8078)

Co-authored-by: calvin <jianghuachinacom@163.com>
2.0.7-release
wind 3 years ago committed by GitHub
parent
commit
5158f4a0a9
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

@ -366,17 +366,18 @@ public class EnvironmentServiceImpl extends BaseServiceImpl implements Environme
env.setOperator(loginUser.getId()); env.setOperator(loginUser.getId());
env.setUpdateTime(new Date()); env.setUpdateTime(new Date());
int update = environmentMapper.update(env, new UpdateWrapper<Environment>().lambda().eq(Environment::getCode,code)); int update = environmentMapper.update(env, new UpdateWrapper<Environment>().lambda().eq(Environment::getCode, code));
if (update > 0) { if (update > 0) {
deleteWorkerGroupSet.stream().forEach(key -> { deleteWorkerGroupSet.stream().forEach(key -> {
if (!StringUtils.isEmpty(key)) { if (StringUtils.isNotEmpty(key)) {
relationMapper.delete(new QueryWrapper<EnvironmentWorkerGroupRelation>() relationMapper.delete(new QueryWrapper<EnvironmentWorkerGroupRelation>()
.lambda() .lambda()
.eq(EnvironmentWorkerGroupRelation::getEnvironmentCode,code)); .eq(EnvironmentWorkerGroupRelation::getEnvironmentCode, code)
.eq(EnvironmentWorkerGroupRelation::getWorkerGroup, key));
} }
}); });
addWorkerGroupSet.stream().forEach(key -> { addWorkerGroupSet.stream().forEach(key -> {
if (!StringUtils.isEmpty(key)) { if (StringUtils.isNotEmpty(key)) {
EnvironmentWorkerGroupRelation relation = new EnvironmentWorkerGroupRelation(); EnvironmentWorkerGroupRelation relation = new EnvironmentWorkerGroupRelation();
relation.setEnvironmentCode(code); relation.setEnvironmentCode(code);
relation.setWorkerGroup(key); relation.setWorkerGroup(key);

Loading…
Cancel
Save