feat: model_manage 增加 ref_system_model_id 引用列与引用 DTO

- entity/dto 落地 ref_system_model_id 字段 + ReferenceSystemModelReq/Res
- DAO 新增 CountReferences / UpdateReferencesName 辅助方法
- roundtrip 单测验证 DTO→entity 映射

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-29 14:35:12 +08:00
co-authored by Claude
parent 928682f121
commit 4afb920456
5 changed files with 75 additions and 1 deletions
+12 -1
View File
@@ -317,4 +317,15 @@ COMMENT ON COLUMN model_gateway_model_task_start.media_type
ALTER TABLE model_gateway_model_task_end
ADD COLUMN IF NOT EXISTS total_cost NUMERIC DEFAULT 0;
COMMENT ON COLUMN model_gateway_model_task_end.total_cost
IS '本次调用总费用(元),未配置计费规则为0';
IS '本次调用总费用(元),未配置计费规则为0';
-- =========================
-- 模型引用化:model_manage 新增 ref_system_model_id(引用行指向系统模型)
-- 系统模型 = 配置唯一来源;引用行只存 apiKey/enabled/chatModel,配置列留空
-- =========================
ALTER TABLE model_gateway_model_manage
ADD COLUMN IF NOT EXISTS ref_system_model_id BIGINT DEFAULT NULL;
COMMENT ON COLUMN model_gateway_model_manage.ref_system_model_id
IS '引用的系统模型IDNULL=非引用行;system_model=false 且该列非空=引用行)';
CREATE INDEX IF NOT EXISTS idx_model_manage_ref_system_model_id
ON model_gateway_model_manage(ref_system_model_id);