fix: 修复脱敏后的apikey也被更新了

This commit is contained in:
ageerle
2025-05-27 17:55:34 +08:00
parent 463ad6c583
commit fcdcf534f1

View File

@@ -94,7 +94,9 @@ public class ChatModelServiceImpl implements IChatModelService {
@Override @Override
public Boolean updateByBo(ChatModelBo bo) { public Boolean updateByBo(ChatModelBo bo) {
ChatModel update = MapstructUtils.convert(bo, ChatModel.class); ChatModel update = MapstructUtils.convert(bo, ChatModel.class);
if (update != null) {
validEntityBeforeSave(update); validEntityBeforeSave(update);
}
return baseMapper.updateById(update) > 0; return baseMapper.updateById(update) > 0;
} }
@@ -102,7 +104,11 @@ public class ChatModelServiceImpl implements IChatModelService {
* 保存前的数据校验 * 保存前的数据校验
*/ */
private void validEntityBeforeSave(ChatModel entity){ private void validEntityBeforeSave(ChatModel entity){
//TODO 做一些数据校验,如唯一约束 // 判断是否包含*号
if (entity.getApiKey().contains("*")) {
// 重新设置key信息
entity.setApiKey(baseMapper.selectById(entity.getId()).getApiKey());
}
} }
/** /**