-- ==========================================================
-- 库房菜单调整（无权限控制版）
-- ==========================================================

-- ----------------------------------------------------------
-- 1. 复活并修正"采购需求"菜单
-- ----------------------------------------------------------
UPDATE sys_menu
   SET menu_name = '采购需求',
       path      = 'requirement',
       component = 'oa/task/requirement/index',
       perms     = NULL,
       visible   = '0',
       status    = '0',
       order_num = 30,
       icon      = 'tool'
 WHERE menu_id  = 1968929776643162114;

-- ----------------------------------------------------------
-- 2. 新增"出库明细"菜单
-- ----------------------------------------------------------
INSERT INTO sys_menu
  (menu_id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES
  (2059900000000000001, '出库明细', 1852933620281430018, 65,
   'outDetail', 'oa/oaOutWarehouse/detail', 'C', '0', '0',
   NULL, 'detail', 'admin', NOW());

-- ----------------------------------------------------------
-- 3. 新增"操作日志"菜单
-- ----------------------------------------------------------
INSERT INTO sys_menu
  (menu_id, menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES
  (2059900000000000002, '操作日志', 1852933620281430018, 90,
   'auditLog', 'oa/oaWarehouse/auditLog', 'C', '0', '0',
   NULL, 'log', 'admin', NOW());

-- ----------------------------------------------------------
-- 4. 隐藏过时/测试菜单（visible='1' = 隐藏）
-- ----------------------------------------------------------
UPDATE sys_menu SET visible = '1'
 WHERE menu_id IN (
    1920003824857874433,  -- 测试页面
    1938799329876361217,  -- 退库日志
    1906233436477644801   -- 采购计划
 );

-- ----------------------------------------------------------
-- 5. 重排库房一级菜单顺序
-- ----------------------------------------------------------
UPDATE sys_menu SET order_num = 10  WHERE menu_id = 1925143921102114818;  -- 智慧库房
UPDATE sys_menu SET order_num = 20  WHERE menu_id = 1852933963887202305;  -- 库存管理
UPDATE sys_menu SET order_num = 30  WHERE menu_id = 1968929776643162114;  -- 采购需求
UPDATE sys_menu SET order_num = 40  WHERE menu_id = 1906249355421573121;  -- 车间采购
UPDATE sys_menu SET order_num = 50  WHERE menu_id = 1902604787711459329;  -- 入库明细
UPDATE sys_menu SET order_num = 60  WHERE menu_id = 1853343196679536641;  -- 仓库出库
UPDATE sys_menu SET order_num = 65  WHERE menu_id = 2059900000000000001;  -- 出库明细
UPDATE sys_menu SET order_num = 70  WHERE menu_id = 1938787785255927809;  -- 退库管理
UPDATE sys_menu SET order_num = 90  WHERE menu_id = 2059900000000000002;  -- 操作日志

-- ----------------------------------------------------------
-- 6. 校验
-- ----------------------------------------------------------
SELECT menu_id, menu_name, path, component, visible, order_num
  FROM sys_menu
 WHERE parent_id = 1852933620281430018
   AND status = '0'
 ORDER BY order_num;
