-- 将「设备补货单」模块添加到「库存管理」下
-- 对应移除前端静态路由 replenishmentOrder.ts

-- 添加菜单
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive)
VALUES (505, 500, 0, '设备补货单', 'ReplenishmentOrder', '/inventory/replenishment-order', '', 4, 'ep:shopping-cart', 1, 0, '/inventory/replenishment-order/list', 1)
ON DUPLICATE KEY UPDATE parent_id=500, title='设备补货单', path='/inventory/replenishment-order', `rank`=4;

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent)
VALUES (506, 505, 0, '补货单列表', 'ReplenishmentOrderList', '/inventory/replenishment-order/list', 'replenishment-order/index', 1, 1, 0)
ON DUPLICATE KEY UPDATE parent_id=505, title='补货单列表', path='/inventory/replenishment-order/list', component='replenishment-order/index', `rank`=1;

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent)
VALUES (507, 505, 0, '补货单详情', 'ReplenishmentOrderDetail', '/inventory/replenishment-order/detail', 'replenishment-order/detail', 2, 0, 0)
ON DUPLICATE KEY UPDATE parent_id=505, title='补货单详情', path='/inventory/replenishment-order/detail', component='replenishment-order/detail', `rank`=2;

-- 为超级管理员角色分配菜单
INSERT INTO t_role_menu (role_id, menu_id, create_time) VALUES (1, 505, NOW()) ON DUPLICATE KEY UPDATE role_id=1;
INSERT INTO t_role_menu (role_id, menu_id, create_time) VALUES (1, 506, NOW()) ON DUPLICATE KEY UPDATE role_id=1;
INSERT INTO t_role_menu (role_id, menu_id, create_time) VALUES (1, 507, NOW()) ON DUPLICATE KEY UPDATE role_id=1;

-- 如果之前菜单 id=505/506/507 已被其他数据占用，先查询确认：
-- SELECT id, parent_id, title, path FROM t_menu WHERE id IN (505, 506, 507);
