fix: 修复工作时间配置保存问题,配置不存在时自动创建
This commit is contained in:
parent
369456a6c6
commit
dba923271f
@ -173,6 +173,23 @@ public class SystemConfigService {
|
||||
if (config != null) {
|
||||
config.setConfigValue(entry.getValue());
|
||||
systemConfigMapper.updateById(config);
|
||||
} else {
|
||||
// 如果配置不存在,创建新配置
|
||||
SystemConfig newConfig = new SystemConfig();
|
||||
newConfig.setConfigKey(entry.getKey());
|
||||
newConfig.setConfigValue(entry.getValue());
|
||||
// 从key中提取group(如 work_hours.start_time -> work_hours)
|
||||
String key = entry.getKey();
|
||||
int dotIndex = key.indexOf('.');
|
||||
if (dotIndex > 0) {
|
||||
newConfig.setConfigGroup(key.substring(0, dotIndex));
|
||||
} else {
|
||||
newConfig.setConfigGroup("system");
|
||||
}
|
||||
newConfig.setConfigName(entry.getKey());
|
||||
newConfig.setValueType("string");
|
||||
newConfig.setBuiltIn(1);
|
||||
systemConfigMapper.insert(newConfig);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user