-- 修复"我的设备"和"设备申请"全屏显示问题
USE soybean_admin;

-- 1. 检查当前配置
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;

-- 2. 修复父路由的 component 配置
-- 确保父路由使用 layout.base
UPDATE sys_route 
SET component = 'layout.base'
WHERE name = 'my-device' AND component != 'layout.base';

UPDATE sys_route 
SET component = 'layout.base'
WHERE name = 'my-application' AND component != 'layout.base';

-- 3. 确保子路由使用正确的 view 组件
UPDATE sys_route 
SET component = 'view.my-device_status'
WHERE name = 'my-device_status' AND component != 'view.my-device_status';

UPDATE sys_route 
SET component = 'view.my-device_remote-control'
WHERE name = 'my-device_remote-control' AND component != 'view.my-device_remote-control';

UPDATE sys_route 
SET component = 'view.my-device_power-control'
WHERE name = 'my-device_power-control' AND component != 'view.my-device_power-control';

UPDATE sys_route 
SET component = 'view.my-application_apply'
WHERE name = 'my-application_apply' AND component != 'view.my-application_apply';

UPDATE sys_route 
SET component = 'view.my-application_my-list'
WHERE name = 'my-application_my-list' AND component != 'view.my-application_my-list';

-- 4. 验证修复结果
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;

-- 5. 提示
SELECT '=== 重要提示 ===' AS info;
SELECT '修复完成！请重启后端服务并清除浏览器缓存' AS message;
