-- V61: 修正审批模板角色码不一致问题
-- 用途: 修正V60中错误的角色码，将 customer_service_leader 修正为 cs_manager
-- 对应问题: 审批模板中角色码与系统定义不一致，导致审批人解析可能为空

-- 修正用户删除审批模板中的角色码
UPDATE sys_approval_flow SET
    nodes = '[{"nodeIndex":1,"nodeName":"客服主管审核","approverType":"ROLE","roleCode":"cs_manager"},{"nodeIndex":2,"nodeName":"运营总监审核","approverType":"ROLE","roleCode":"operation_director"}]'
WHERE trigger_event = 'USER_DELETE';

-- 修正所有包含 customer_service_leader 的模板节点
UPDATE sys_approval_flow SET
    nodes = REPLACE(nodes, '"roleCode":"customer_service_leader"', '"roleCode":"cs_manager"')
WHERE nodes LIKE '%customer_service_leader%';
