-- V77: 修复活动删除审批角色为运营经理（与PRD 7.1对齐）
-- PRD要求: 活动删除审批由运营经理审批

-- 更新ACTIVITY_DELETE审批模板，将审批角色从运营总监改为运营经理
UPDATE sys_approval_flow
SET nodes = '[{"nodeIndex":1,"nodeName":"运营经理审核","approverType":"ROLE","approverCodes":["operation_manager"]}]'
WHERE trigger_event = 'ACTIVITY_DELETE';

-- 如果记录不存在，插入新的正确模板
INSERT INTO sys_approval_flow (flow_code, flow_name, trigger_event, conditions, nodes, timeout_hours, timeout_action, status, created_at)
SELECT 'ACTIVITY_DELETE', '活动删除审批', 'ACTIVITY_DELETE', NULL,
       '[{"nodeIndex":1,"nodeName":"运营经理审核","approverType":"ROLE","approverCodes":["operation_manager"]}]',
       24, 'ESCALATE', 'ENABLED', CURRENT_TIMESTAMP
WHERE NOT EXISTS (SELECT 1 FROM sys_approval_flow WHERE trigger_event = 'ACTIVITY_DELETE');
