diff --git a/saturn-console-api/src/main/java/com/vip/saturn/job/console/controller/gui/ConsoleConfigController.java b/saturn-console-api/src/main/java/com/vip/saturn/job/console/controller/gui/ConsoleConfigController.java index 6cd569a96..e8248ec96 100644 --- a/saturn-console-api/src/main/java/com/vip/saturn/job/console/controller/gui/ConsoleConfigController.java +++ b/saturn-console-api/src/main/java/com/vip/saturn/job/console/controller/gui/ConsoleConfigController.java @@ -104,7 +104,7 @@ public SuccessResponseEntity getConfigs() throws IOException, SaturnJobConsoleEx //获取配置meta Map> jobConfigGroups = getSystemConfigMeta(); //返回所有配置信息 - List systemConfigs = systemConfigService.getAllSystemConfigs(); + List systemConfigs = systemConfigService.getSystemConfigsDirectly(null); //剔除EXECUTOR_CONFIGS removeExecutorConfigs(systemConfigs); diff --git a/saturn-console-api/src/main/java/com/vip/saturn/job/console/service/impl/SystemConfigServiceImpl.java b/saturn-console-api/src/main/java/com/vip/saturn/job/console/service/impl/SystemConfigServiceImpl.java index 669816938..9db4bafc9 100644 --- a/saturn-console-api/src/main/java/com/vip/saturn/job/console/service/impl/SystemConfigServiceImpl.java +++ b/saturn-console-api/src/main/java/com/vip/saturn/job/console/service/impl/SystemConfigServiceImpl.java @@ -210,7 +210,7 @@ public Integer createConfig(SystemConfig systemConfig) throws SaturnJobConsoleEx } } - if (systemConfig != null && systemConfigs.size() > 0 && found) { + if (found) { throw new SaturnJobConsoleException( String.format("systemConfig %s already existed", systemConfig.getProperty())); } @@ -224,22 +224,14 @@ public Integer createConfig(SystemConfig systemConfig) throws SaturnJobConsoleEx public Integer updateConfig(SystemConfig systemConfig) throws SaturnJobConsoleException { List properties = new ArrayList<>(); properties.add(systemConfig.getProperty()); - List systemConfigs = systemConfig4SqlService.selectByProperty(systemConfig.getProperty()); + List systemConfigs = systemConfig4SqlService.selectByPropertiesAndLastly(properties); - SystemConfig targetConfig = null; - for (int i = 0; i < systemConfigs.size(); i++) { - SystemConfig config = systemConfigs.get(i); - if (StringUtils.equals(config.getProperty(), systemConfig.getProperty())) { - targetConfig = config; - break; - } - } - if (targetConfig == null) { + if (systemConfigs.size() == 0) { throw new SaturnJobConsoleException( String.format("systemConfig %s not existed, update fail", systemConfig.getProperty())); } - SystemConfig config = targetConfig; + SystemConfig config = systemConfigs.get(0); config.setProperty(systemConfig.getProperty()); config.setValue(systemConfig.getValue()); int result = systemConfig4SqlService.updateById(config);