-- 添加桌面管理菜单
-- 数据库: amtscanner
-- 已执行: 2026-01-20

-- 添加一级菜单：桌面管理
INSERT INTO `Menus` (`Id`, `ParentId`, `Name`, `Path`, `Component`, `Title`, `Icon`, `Sort`, `Roles`, `IsSystem`, `IsHide`, `KeepAlive`, `IsIframe`, `IsHideTab`, `CreatedAt`)
VALUES (20, NULL, 'DesktopManage', '/desktop-manage', '/index/index', '桌面管理', 'ri:remote-control-line', 3, 'R_SUPER,R_ADMIN', 1, 0, 0, 0, 0, NOW());

-- 添加二级菜单：远程桌面
INSERT INTO `Menus` (`Id`, `ParentId`, `Name`, `Path`, `Component`, `Title`, `Icon`, `Sort`, `Roles`, `IsSystem`, `IsHide`, `KeepAlive`, `IsIframe`, `IsHideTab`, `CreatedAt`)
VALUES (21, 20, 'DesktopDevices', 'devices', '/desktop-manage/devices', '远程桌面', NULL, 1, 'R_SUPER,R_ADMIN', 1, 0, 1, 0, 0, NOW());

-- 为超级管理员角色分配新菜单权限
INSERT INTO `RoleMenus` (`RoleId`, `MenuId`)
SELECT r.Id, 20 FROM `Roles` r WHERE r.RoleCode = 'R_SUPER';

INSERT INTO `RoleMenus` (`RoleId`, `MenuId`)
SELECT r.Id, 21 FROM `Roles` r WHERE r.RoleCode = 'R_SUPER';

-- 为管理员角色分配新菜单权限
INSERT INTO `RoleMenus` (`RoleId`, `MenuId`)
SELECT r.Id, 20 FROM `Roles` r WHERE r.RoleCode = 'R_ADMIN';

INSERT INTO `RoleMenus` (`RoleId`, `MenuId`)
SELECT r.Id, 21 FROM `Roles` r WHERE r.RoleCode = 'R_ADMIN';
