-- 添加"我的设备"和"设备申请"路由配置
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;
