-- 利率定价流程菜单配置
-- 注意：Windows 环境下执行后可能需要使用 CONVERT 修复编码问题

-- 删除旧数据
DELETE FROM sys_role_menu WHERE menu_id IN (2000, 2001, 2002);
DELETE FROM sys_menu WHERE menu_id IN (2000, 2001, 2002);

-- 一级菜单：利率定价管理
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES(2000, '利率定价管理', 0, 5, 'loanPricing', NULL, 1, 0, 'M', '0', '0', '', 'money', 'admin', NOW(), '');

-- 二级菜单：流程列表
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES(2001, '流程列表', 2000, 1, 'workflow', 'loanPricing/workflow/index', 1, 0, 'C', '0', '0', 'loanPricing:workflow:list', 'list', 'admin', NOW(), '');

-- 流程列表查询按钮
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
VALUES(2002, '流程查询', 2001, 1, '', '', 1, 0, 'F', '0', '0', 'loanPricing:workflow:query', '#', 'admin', NOW(), '');

-- 关联管理员角色
INSERT INTO sys_role_menu VALUES(1, 2000), (1, 2001), (1, 2002);

-- 如果 Windows 环境导致中文乱码，执行以下语句修复：
-- UPDATE sys_menu SET menu_name = CONVERT(CAST(CONVERT(menu_name USING latin1) AS BINARY) USING utf8mb4) WHERE menu_id IN (2000, 2001, 2002);
