fix(surgery): #684 手术状态下拉框重复 - 清理字典重复数据

This commit is contained in:
2026-06-17 11:02:18 +08:00
parent 1c68860541
commit 5a227014fe

View File

@@ -0,0 +1,15 @@
-- Bug #684: 手术状态下拉框有重复
-- 原因sys_dict_data 中 surgery_status 类型存在重复记录(每个 dict_value 有3条
-- 修复:删除重复记录,每个 dict_value 只保留 dict_code 最小的一条
DELETE FROM sys_dict_data
WHERE dict_code IN (
SELECT dict_code
FROM (
SELECT dict_code,
ROW_NUMBER() OVER (PARTITION BY dict_type, dict_value ORDER BY dict_code ASC) as rn
FROM sys_dict_data
WHERE dict_type = 'surgery_status'
) t
WHERE rn > 1
);