SET NAMES utf8mb4;

-- 修复菜单名称乱码问题
-- 根据截图中显示的权限字符，还原正确的菜单名称

-- 订单管理相关菜单
UPDATE sys_menu SET menu_name = '订单管理' WHERE perms = 'bid:order:list' AND menu_name LIKE '%璁㈠%';
UPDATE sys_menu SET menu_name = '待发订单' WHERE perms = 'bid:order:pending' AND menu_name LIKE '%寰%';
UPDATE sys_menu SET menu_name = '在途订单' WHERE perms = 'bid:order:transit' AND menu_name LIKE '%鍦ㄩ%';
UPDATE sys_menu SET menu_name = '历史订单' WHERE perms = 'bid:order:history' AND menu_name LIKE '%鍘嗗彶%';
UPDATE sys_menu SET menu_name = '结单时间' WHERE perms = 'bid:order:closeDate' AND menu_name LIKE '%缁撳崟%';

-- 甲方客户管理
UPDATE sys_menu SET menu_name = '甲方客户' WHERE perms = 'bid:client:list' AND menu_name LIKE '%鐢插彛%';

-- 操作记录
UPDATE sys_menu SET menu_name = '操作记录' WHERE perms = 'bid:operationlog:list' AND menu_name LIKE '%鎿嶄綔%';
UPDATE sys_menu SET menu_name = '查询' WHERE perms = 'bid:operationlog:query' AND menu_name LIKE '%鏌ヨ%';

-- 如果上述更新没有匹配到，使用menu_id直接更新（根据截图中的排序号判断）
-- 订单管理目录（排序号10）
UPDATE sys_menu SET menu_name = '订单管理' WHERE menu_id IN (
    SELECT menu_id FROM (SELECT menu_id FROM sys_menu WHERE parent_id = 0 AND order_num = 10) AS t
);

-- 查询更新结果
SELECT menu_id, menu_name, perms, order_num 
FROM sys_menu 
WHERE perms LIKE 'bid:order:%' OR perms LIKE 'bid:client:%' OR perms LIKE 'bid:operationlog:%'
ORDER BY menu_id;
