chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
@@ -0,0 +1,32 @@
-- Apply after the Admin and UI versions containing the full-sync monitor are deployed.
-- In System Management > Roles, grant both the parent System Monitor menu
-- and the Full Sync child menu to ops roles. Grant Start/Failure Details
-- separately as needed. This script does not change any role assignments.
INSERT INTO sys_menu
(menu_name, parent_id, level, order_num, path, component, query_param,
is_frame, is_cache, menu_type, visible, status, perms, icon, remark)
SELECT '全量同步', parent.menu_id, 1, 7, 'full-sync', 'monitor/full-sync/index', '',
1, 0, 'C', '0', '0', 'iot:fullSyncRuns:view', 'lucide:refresh-cw', '全量同步结果与手动启动'
FROM sys_menu AS parent
WHERE parent.path = 'monitor' AND parent.parent_id = 0
AND NOT EXISTS (
SELECT 1 FROM sys_menu AS existing
WHERE existing.parent_id = parent.menu_id AND existing.path = 'full-sync'
);
INSERT INTO sys_menu
(menu_name, parent_id, level, order_num, path, component, query_param,
is_frame, is_cache, menu_type, visible, status, perms, icon, remark)
SELECT permissions.name, menu.menu_id, 2, permissions.order_num, '', '', '',
1, 0, 'F', '0', '0', permissions.perms, '#', ''
FROM sys_menu AS menu
JOIN sys_menu AS parent ON menu.parent_id = parent.menu_id AND parent.path = 'monitor' AND parent.parent_id = 0
JOIN (
SELECT '查看失败明细' AS name, 1 AS order_num, 'iot:fullSyncRuns:failures' AS perms
UNION ALL SELECT '手动启动全量同步', 2, 'iot:fullSyncRuns:start'
) AS permissions
WHERE menu.path = 'full-sync'
AND NOT EXISTS (
SELECT 1 FROM sys_menu AS existing
WHERE existing.parent_id = menu.menu_id AND existing.perms = permissions.perms
);
@@ -0,0 +1,99 @@
-- ============================================================
-- 流量池预警配置独立权限码(业务受理入口卡片可独立隐藏)
-- ============================================================
-- 背景:
-- 「业务受理」页的入口卡片按 accessCodes 过滤显隐。
-- 「流量预警配置」与「流量池预警配置」原先共用同一组
-- cpm:iot:tSimWarningConfig:* 权限码,导致收权时两个入口一起消失。
-- 本脚本为流量池预警配置新增专属权限项
-- cpm:iot:tSimPoolWarnConfig:*,与原权限项并存。
--
-- 前置条件:Admin / UI 版本已包含「入口卡片按权限独立隐藏」的改动。
--
-- 兼容性:
-- 1) sys_menu 保留原有 4 条 tSimWarningConfig 权限项,不动。
-- 2) 新增的 4 条 tSimPoolWarnConfig 权限项,按「拥有对应旧权限项的角色」自动授权,
-- 因此存量角色在执行本脚本后:
-- - 仍能看到「流量预警配置」入口(旧权限码保留)
-- - 仍能看到「流量池预警配置」入口(新权限码已自动补授)
-- - 调用 /iot/tSimWarningConfig/* 接口不会 403
-- (后端已把接口的 x-check-permission 改为「新码 OR 旧码」)
-- 3) 后续若只想关闭「流量池预警配置」,管理员在角色管理里去掉新权限项即可,
-- 不再影响「流量预警配置」。
-- 4) 超级管理员(role_id=1)走独立的超管判定,不依赖菜单权限,无需授权。
--
-- 执行范围:生产 / 预演 / 演示 环境各自的 db_iotlcm 库。
-- 幂等:可重复执行(先删后插)。
--
-- ============================================================
-- ------------------------------------------------------------
-- 1) 新增 4 条流量池预警配置权限项(挂在「业务受理」菜单下)
-- ------------------------------------------------------------
DELETE FROM sys_menu
WHERE perms IN (
'iot:tSimPoolWarnConfig:excel:template',
'iot:tSimPoolWarnConfig:excel:submit',
'iot:tSimPoolWarnConfig:input:submit',
'iot:tSimPoolWarnConfig:range:submit'
);
INSERT INTO sys_menu
(menu_name, parent_id, level, order_num, path, component, query_param,
is_frame, is_cache, menu_type, visible, status, perms, icon, remark)
SELECT permissions.name, parent.menu_id, 2, permissions.order_num, '', '', '',
1, 0, 'F', '0', '0', permissions.perms, '#', '流量池预警配置(独立权限)'
FROM sys_menu AS parent
JOIN (
SELECT '下载流量池预警配置Excel模板' AS name, 20 AS order_num, 'iot:tSimPoolWarnConfig:excel:template' AS perms
UNION ALL SELECT '提交流量池预警配置Excel', 21, 'iot:tSimPoolWarnConfig:excel:submit'
UNION ALL SELECT '批量输入流量池预警配置', 22, 'iot:tSimPoolWarnConfig:input:submit'
UNION ALL SELECT '连号流量池预警配置', 23, 'iot:tSimPoolWarnConfig:range:submit'
) AS permissions
WHERE parent.component = 'iotlcm/tCommunication/tBusinessAcceptance/index';
-- ------------------------------------------------------------
-- 2) 角色授权:把新权限项授予「原本就拥有对应旧权限项」的角色
-- (即拥有 tSimWarningConfig 权限的角色,同步获得 tSimPoolWarnConfig)
-- 注意:sys_role_menu 的 (tenant_id, role_id, menu_id) 是联合主键,
-- data_scope 为 NOT NULL,沿用旧授权行的取值。
-- ------------------------------------------------------------
DELETE FROM sys_role_menu
WHERE menu_id IN (
SELECT menu_id FROM sys_menu
WHERE perms IN (
'iot:tSimPoolWarnConfig:excel:template',
'iot:tSimPoolWarnConfig:excel:submit',
'iot:tSimPoolWarnConfig:input:submit',
'iot:tSimPoolWarnConfig:range:submit'
)
);
INSERT INTO sys_role_menu (tenant_id, role_id, menu_id, data_scope)
SELECT old.tenant_id, old.role_id, new.menu_id, old.data_scope
FROM sys_role_menu AS old
JOIN sys_menu AS old_menu ON old_menu.menu_id = old.menu_id
JOIN sys_menu AS new
ON new.parent_id = old_menu.parent_id
AND new.perms = REPLACE(old_menu.perms, 'iot:tSimWarningConfig:', 'iot:tSimPoolWarnConfig:')
WHERE old_menu.perms IN (
'iot:tSimWarningConfig:excel:template',
'iot:tSimWarningConfig:excel:submit',
'iot:tSimWarningConfig:input:submit',
'iot:tSimWarningConfig:range:submit'
);
-- ------------------------------------------------------------
-- 3) 校验(执行后手工跑,确认与预期一致)
-- ------------------------------------------------------------
-- SELECT perms, COUNT(*) FROM sys_menu
-- WHERE perms LIKE 'iot:tSimPoolWarnConfig:%' GROUP BY perms;
-- 期望 4 行,各 1 条
--
-- SELECT r.role_id, r.role_name, COUNT(*) AS new_perms
-- FROM sys_role_menu rm
-- JOIN sys_menu m ON m.menu_id = rm.menu_id
-- JOIN sys_role r ON r.role_id = rm.role_id
-- WHERE m.perms LIKE 'iot:tSimPoolWarnConfig:%'
-- GROUP BY r.role_id, r.role_name;
-- 期望:与拥有 tSimWarningConfig 权限的角色集合完全相同
File diff suppressed because one or more lines are too long