-- 修复 my_device 和 my_application 路由命名问题
-- 将下划线改为连字符以匹配前端期望
USE soybean_admin;

SELECT '=== 开始修复路由命名 ===' AS info;

-- 1. 修复 my_device 相关路由
UPDATE sys_route 
SET name = 'my-device'
WHERE name = 'my_device';

UPDATE sys_route 
SET name = 'my-device_status'
WHERE name = 'my_device_status';

UPDATE sys_route 
SET name = 'my-device_power-control'
WHERE name = 'my_device_power';

UPDATE sys_route 
SET name = 'my-device_remote-control'
WHERE name = 'my_device_remote';

-- 2. 修复 my_application 相关路由
UPDATE sys_route 
SET name = 'my-application'
WHERE name = 'my_application';

UPDATE sys_route 
SET name = 'my-application_apply'
WHERE name = 'my_application_apply';

UPDATE sys_route 
SET name = 'my-application_my-list'
WHERE name = 'my_application_list';

SELECT '=== 修复完成，验证结果 ===' AS info;

-- 3. 验证修复结果
SELECT 
    route_id,
    name,
    path,
    component,
    JSON_EXTRACT(meta, '$.title') as title
FROM sys_route 
WHERE name LIKE 'my-%'
ORDER BY order_num;

SELECT '=== 重要提示 ===' AS info;
SELECT '1. 请重启后端服务' AS step1 UNION ALL
SELECT '2. 清除浏览器缓存' AS step2 UNION ALL
SELECT '3. 重新登录测试' AS step3;
