admin/add_my_device_and_application_routes.sql
lvfengfree 44cb688072 fix: 修复路由命名问题 - 将my_device和my_application改为连字符格式
- 问题:数据库中路由使用下划线(my_device),前端期望连字符(my-device)
- 导致路由无法匹配,页面全屏显示
- 添加诊断和修复脚本:
  * check_route_naming.sql - 检查路由命名问题
  * fix_my_routes_naming.sql - 修复路由命名
  * fix_my_routes_naming.bat - 批处理执行脚本
- 修复后需要重启后端服务和清除浏览器缓存
2026-03-01 10:36:18 +08:00

50 lines
2.5 KiB
SQL

-- 添加"我的设备"和"设备申请"路由配置
USE soybean_admin;
-- 1. 先删除可能存在的旧数据(如果有)
DELETE FROM sys_route WHERE name LIKE 'my-device%' OR name LIKE 'my-application%';
-- 2. 添加"我的设备"父路由
INSERT INTO sys_route (route_id, name, path, component, meta, status, order_num) VALUES
('my-device', 'my-device', '/my-device', 'layout.base',
'{"title":"我的设备","i18nKey":"route.my-device","icon":"mdi:laptop","order":7}',
1, 70);
-- 3. 添加"我的设备"子路由
INSERT INTO sys_route (route_id, name, path, component, meta, status, order_num) VALUES
('my-device_status', 'my-device_status', '/my-device/status', 'view.my-device_status',
'{"title":"设备状态","i18nKey":"route.my-device_status","icon":"mdi:information","order":1}',
1, 71),
('my-device_remote-control', 'my-device_remote-control', '/my-device/remote-control', 'view.my-device_remote-control',
'{"title":"远程控制","i18nKey":"route.my-device_remote-control","icon":"mdi:remote-desktop","order":2}',
1, 72),
('my-device_power-control', 'my-device_power-control', '/my-device/power-control', 'view.my-device_power-control',
'{"title":"电源控制","i18nKey":"route.my-device_power-control","icon":"mdi:power","order":3}',
1, 73);
-- 4. 添加"设备申请"父路由
INSERT INTO sys_route (route_id, name, path, component, meta, status, order_num) VALUES
('my-application', 'my-application', '/my-application', 'layout.base',
'{"title":"设备申请","i18nKey":"route.my-application","icon":"mdi:file-document","order":8}',
1, 80);
-- 5. 添加"设备申请"子路由
INSERT INTO sys_route (route_id, name, path, component, meta, status, order_num) VALUES
('my-application_apply', 'my-application_apply', '/my-application/apply', 'view.my-application_apply',
'{"title":"申请设备","i18nKey":"route.my-application_apply","icon":"mdi:file-plus","order":1}',
1, 81),
('my-application_my-list', 'my-application_my-list', '/my-application/my-list', 'view.my-application_my-list',
'{"title":"我的申请","i18nKey":"route.my-application_my-list","icon":"mdi:format-list-bulleted","order":2}',
1, 82);
-- 6. 验证添加结果
SELECT '=== 我的设备路由 ===' AS info;
SELECT route_id, name, path, component, meta FROM sys_route WHERE name LIKE 'my-device%' ORDER BY order_num;
SELECT '=== 设备申请路由 ===' AS info;
SELECT route_id, name, path, component, meta FROM sys_route WHERE name LIKE 'my-application%' ORDER BY order_num;
-- 7. 提示
SELECT '=== 重要提示 ===' AS info;
SELECT '请重启后端服务使配置生效!' AS message;