修复:算法绑定部分更新时保留未发送字段的旧值
前端可能只发送 params 等部分字段,未发送的字段保留数据库原值。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -261,6 +261,12 @@ public class AiRoiServiceImpl implements IAiRoiService {
|
||||
if (old == null) {
|
||||
throw new IllegalArgumentException("绑定关系不存在");
|
||||
}
|
||||
// 部分更新:前端可能只发送部分字段,未发送的字段保留旧值
|
||||
if (bind.getParams() == null) bind.setParams(old.getParams());
|
||||
if (bind.getPriority() == null) bind.setPriority(old.getPriority());
|
||||
if (bind.getEnabled() == null) bind.setEnabled(old.getEnabled());
|
||||
if (bind.getTemplateId() == null) bind.setTemplateId(old.getTemplateId());
|
||||
if (bind.getParamOverride() == null) bind.setParamOverride(old.getParamOverride());
|
||||
bind.setUpdateTime(now);
|
||||
bindMapper.updateByBindId(bind);
|
||||
configLogService.addLog("BIND", bind.getBindId(), toJson(old), toJson(bind), null);
|
||||
|
||||
Reference in New Issue
Block a user