-- --------------------------------------------------------------------- -- 渠道拓展:汇智内部认证级别(字典 tz_rzjb)标签调整 -- 需求: -- 1) 省代 -> 汇智省代 -- 2) 金牌 -> 汇智金牌 -- 3) 非认证渠道 -> 潜力渠道 -- 4) 新增:汇智精英渠道(item_value = '05',启用) -- 5) 国代('01')不在新标签集内,改为停用(status = 0) -- 幂等:以 item_value 作为稳定键,UPDATE/INSERT 均可安全重复执行。 -- --------------------------------------------------------------------- begin; -- 1) 省代 -> 汇智省代 update sys_dict_item set item_label = '汇智省代', sort_order = 1, status = 1, updated_at = now() where type_code = 'tz_rzjb' and item_value = '02' and coalesce(is_deleted, 0) = 0; -- 2) 金牌 -> 汇智金牌 update sys_dict_item set item_label = '汇智金牌', sort_order = 2, status = 1, updated_at = now() where type_code = 'tz_rzjb' and item_value = '03' and coalesce(is_deleted, 0) = 0; -- 3) 非认证渠道 -> 潜力渠道 update sys_dict_item set item_label = '潜力渠道', sort_order = 4, status = 1, updated_at = now() where type_code = 'tz_rzjb' and item_value = '04' and coalesce(is_deleted, 0) = 0; -- 4) 国代不在新标签集内,改为停用 update sys_dict_item set status = 0, updated_at = now() where type_code = 'tz_rzjb' and item_value = '01' and coalesce(is_deleted, 0) = 0; -- 5) 新增:汇智精英渠道(幂等,重复执行不会插入第二行) insert into sys_dict_item (type_code, item_label, item_value, sort_order, status, is_deleted, remark) select 'tz_rzjb', '汇智精英渠道', '05', 3, 1, 0, '认证级别' where not exists ( select 1 from sys_dict_item s where s.type_code = 'tz_rzjb' and s.item_value = '05' and coalesce(s.is_deleted, 0) = 0 ); commit;