feat(xg): 新增按学号重置学生密码(Web/移动端)

学工老师可按学号查询并重置学生登录密码为固定默认值,独立权限不复用系统用户重置。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
“wuzhen”andCursor committed 2026-10-26 08:29:50 +08:00
1 parent 0765f00458
commit df4c21bd0d
14 files changed
+781

No files matched your search

@@ -0,0 +1,76 @@
-- =============================================================================
-- 重置学生密码:菜单 + 按钮权限
-- 日期:2026-10-26
-- 父菜单:学生管理 (1959499382894141441)
-- Web 页面:xg/xsjcxx/studentMsg/studentPwdReset/index
-- 移动端首页入口权限:student:pwdreset:listapp
-- 重置密码固定值(服务端写死):Hzdyjsxs123456!@#
-- 执行:开发/生产库均可幂等执行;执行后给角色勾选菜单或跑下方角色授权段
-- =============================================================================
-- 1. 菜单页(学生管理下级)
INSERT INTO `sys_menu` (
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
`create_dept`, `create_by`, `create_time`, `remark`
)
SELECT 2026102610000000101, '重置学生密码', 1959499382894141441, 16, 'studentPwdReset',
'xg/xsjcxx/studentMsg/studentPwdReset/index', NULL,
1, 0, 'C', '0', '0', 'studentMsg:studentPwdReset:list', 'password',
103, 1, NOW(), '按学号查询并重置学生登录密码'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000101);
-- 2. 按钮:查询
INSERT INTO `sys_menu` (
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
`create_dept`, `create_by`, `create_time`, `remark`
)
SELECT 2026102610000000102, '查询学生', 2026102610000000101, 1, '#', '', NULL,
1, 0, 'F', '0', '0', 'studentMsg:studentPwdReset:query', '#',
103, 1, NOW(), '按学号查询学生信息'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000102);
-- 3. 按钮:重置密码
INSERT INTO `sys_menu` (
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
`create_dept`, `create_by`, `create_time`, `remark`
)
SELECT 2026102610000000103, '确认重置', 2026102610000000101, 2, '#', '', NULL,
1, 0, 'F', '0', '0', 'studentMsg:studentPwdReset:reset', '#',
103, 1, NOW(), '确认重置学生密码'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000103);
-- 4. 移动端首页入口权限(挂在同一菜单页下,供 hasPermi 控制入口可见)
INSERT INTO `sys_menu` (
`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`,
`is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`,
`create_dept`, `create_by`, `create_time`, `remark`
)
SELECT 2026102610000000104, '重置学生密码(移动端)', 2026102610000000101, 3, '', '', NULL,
1, 0, 'F', '0', '0', 'student:pwdreset:listapp', '#',
103, 1, NOW(), '移动端首页入口权限'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `menu_id` = 2026102610000000104);
-- 5. 给已有「学生信息」菜单权限的角色补授权(幂等)
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT DISTINCT rm.role_id, m.menu_id
FROM `sys_role_menu` rm
CROSS JOIN (
SELECT 2026102610000000101 AS menu_id UNION ALL
SELECT 2026102610000000102 UNION ALL
SELECT 2026102610000000103 UNION ALL
SELECT 2026102610000000104
) m
WHERE rm.menu_id = 1948289114628902914
AND NOT EXISTS (
SELECT 1 FROM `sys_role_menu` x
WHERE x.role_id = rm.role_id AND x.menu_id = m.menu_id
);
-- 核对
SELECT menu_id, menu_name, parent_id, path, component, perms, menu_type
FROM sys_menu
WHERE menu_id BETWEEN 2026102610000000101 AND 2026102610000000104
ORDER BY menu_id;