-- V58: 校准审批模板节点与PRD对齐
-- 用途: 修复用户冻结/解冻、敏感导出审批模板节点与PRD规定角色一致
-- 注意: 此迁移可重复执行（幂等）
-- PRD规定:
--   - 用户冻结: 客服主管审批 (cs_manager)
--   - 用户解冻: 客服主管→风控审批 (cs_manager → risk_manager)
--   - 敏感数据导出: 部门负责人审批 (operation_director)

-- 1. 用户冻结审批模板 - 改为客服主管审批
UPDATE sys_approval_flow
SET nodes = '[{"nodeIndex":1,"nodeName":"客服主管审批","approverType":"ROLE","roleCode":"cs_manager"}]'
WHERE trigger_event = 'USER_FREEZE';

-- 2. 用户解冻审批模板 - 改为客服主管→风控审批
UPDATE sys_approval_flow
SET nodes = '[{"nodeIndex":1,"nodeName":"客服主管审批","approverType":"ROLE","roleCode":"cs_manager"},{"nodeIndex":2,"nodeName":"风控经理审批","approverType":"ROLE","roleCode":"risk_manager"}]'
WHERE trigger_event = 'USER_UNFREEZE';

-- 3. 敏感数据导出审批模板 - 改为部门负责人审批
UPDATE sys_approval_flow
SET nodes = '[{"nodeIndex":1,"nodeName":"部门负责人审批","approverType":"ROLE","roleCode":"operation_director"}]'
WHERE trigger_event = 'SENSITIVE_EXPORT';
