-- 审批流程模板角色码修复
-- 版本: V50
-- 描述: 修复V49中的角色码与系统角色码不一致的问题

-- 1. 修复奖励风控审批流程角色码
UPDATE sys_approval_flow
SET nodes = '[{"approverType": "ROLE", "roleCode": "risk_manager", "nodeName": "风控审批"}]'
WHERE flow_code = 'REWARD_RISK_APPROVAL' AND nodes LIKE '%RISK_MANAGER%';

-- 2. 修复奖励风控+财务审批流程角色码
UPDATE sys_approval_flow
SET nodes = '[{"approverType": "ROLE", "roleCode": "risk_manager", "nodeName": "风控审批"}, {"approverType": "ROLE", "roleCode": "finance_manager", "nodeName": "财务审批"}]'
WHERE flow_code = 'REWARD_RISK_FINANCE_APPROVAL' AND nodes LIKE '%MANAGER%';

-- 3. 修复奖励风控+财务+总监审批流程角色码
UPDATE sys_approval_flow
SET nodes = '[{"approverType": "ROLE", "roleCode": "risk_manager", "nodeName": "风控审批"}, {"approverType": "ROLE", "roleCode": "finance_manager", "nodeName": "财务审批"}, {"approverType": "ROLE", "roleCode": "operation_director", "nodeName": "总监审批"}]'
WHERE flow_code = 'REWARD_RISK_FINANCE_DIRECTOR_APPROVAL' AND nodes LIKE '%DIRECTOR%';

-- 4. 修复角色变更审批流程角色码
UPDATE sys_approval_flow
SET nodes = '[{"approverType": "ROLE", "roleCode": "system_admin", "nodeName": "系统管理员审批"}]'
WHERE flow_code = 'ROLE_CHANGE_APPROVAL' AND nodes LIKE '%SYS_ADMIN%';

-- 5. 修复活动创建审批流程角色码
UPDATE sys_approval_flow
SET nodes = '[{"approverType": "ROLE", "roleCode": "operation_manager", "nodeName": "运营经理审批"}]'
WHERE flow_code = 'ACTIVITY_SUBMIT_APPROVAL' AND nodes LIKE '%OPERATIONS_MANAGER%';
