-- ═══════════════════════════════════════════════════════════
-- Excel 批量导入功能 - 权限菜单初始化
-- 物料/客户/供应商 三模块的导入导出按钮权限
-- ═══════════════════════════════════════════════════════════

SET NAMES utf8mb4;

-- 清理可能存在的旧数据
DELETE FROM sys_role_menu WHERE menu_id IN (2140, 2141, 2142, 2143, 2144, 2145);
DELETE FROM sys_menu WHERE menu_id IN (2140, 2141, 2142, 2143, 2144, 2145);

-- 1. 物料导入按钮 (parent=2001 物料管理)
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)
VALUES(2140, UNHEX('E789A9E69699E5AFBCE585A5'), 2001, 7, '', NULL, 1, 0, 'F', '0', '0', 'bid:material:import', '#', 'admin', NOW());

-- 2. 物料导出按钮
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)
VALUES(2141, UNHEX('E789A9E69699E5AFBCE587BA'), 2001, 8, '', NULL, 1, 0, 'F', '0', '0', 'bid:material:export', '#', 'admin', NOW());

-- 3. 客户导入按钮 (parent=2028 甲方客户管理)
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)
VALUES(2142, UNHEX('E5AEA2E688B7E5AFBCE585A5'), 2028, 10, '', NULL, 1, 0, 'F', '0', '0', 'bid:client:import', '#', 'admin', NOW());

-- 4. 客户导出按钮
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)
VALUES(2143, UNHEX('E5AEA2E688B7E5AFBCE587BA'), 2028, 11, '', NULL, 1, 0, 'F', '0', '0', 'bid:client:export', '#', 'admin', NOW());

-- 5. 供应商导入按钮 (parent=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)
VALUES(2144, UNHEX('E4BE9BE5BA94E59586E5AFBCE585A5'), 2002, 7, '', NULL, 1, 0, 'F', '0', '0', 'bid:supplier:import', '#', 'admin', NOW());

-- 6. 供应商导出按钮
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)
VALUES(2145, UNHEX('E4BE9BE5BA94E59586E5AFBCE587BA'), 2002, 8, '', NULL, 1, 0, 'F', '0', '0', 'bid:supplier:export', '#', 'admin', NOW());

-- 7. 给 admin 角色授权
INSERT INTO sys_role_menu(role_id, menu_id) VALUES(1, 2140);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES(1, 2141);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES(1, 2142);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES(1, 2143);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES(1, 2144);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES(1, 2145);
