-- 演出票退款原因管理 - 菜单与权限
-- 挂载在：正在映画 → 退款管理 下面（与「订单退款列表」「演出退款管理」同级）

SET @zhengzaiRootId = (
    SELECT menu_id
    FROM sys_menu
    WHERE menu_name = '正在映画'
      AND parent_id = 0
    LIMIT 1
);

SET @refundManageId = (
    SELECT menu_id
    FROM sys_menu
    WHERE menu_name = '退款管理'
      AND parent_id = @zhengzaiRootId
    LIMIT 1
);

INSERT INTO sys_menu (menu_name, parent_id, order_num, url, target, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES ('退款原因管理', @refundManageId, 2, '/kylin/refundReasons', 'menuItem', 'C', '0', 'kylin:refundReasons:list', '#', 'admin', NOW(), '', NULL, '演出票退款原因配置');

SET @menuId = LAST_INSERT_ID();

INSERT INTO sys_menu (menu_name, parent_id, order_num, url, target, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES
('退款原因查询', @menuId, 1, '#', '', 'F', '0', 'kylin:refundReasons:list', '#', 'admin', NOW(), '', NULL, ''),
('退款原因新增', @menuId, 2, '#', '', 'F', '0', 'kylin:refundReasons:create', '#', 'admin', NOW(), '', NULL, ''),
('退款原因修改', @menuId, 3, '#', '', 'F', '0', 'kylin:refundReasons:update', '#', 'admin', NOW(), '', NULL, ''),
('退款原因删除', @menuId, 4, '#', '', 'F', '0', 'kylin:refundReasons:delete', '#', 'admin', NOW(), '', NULL, ''),
('退款原因应用', @menuId, 5, '#', '', 'F', '0', 'kylin:refundReasons:apply', '#', 'admin', NOW(), '', NULL, '');
