限制两个管理员

This commit is contained in:
zhanglipeng 2021-01-26 09:25:51 +08:00
parent ea4f4d18bf
commit a4e61f1801
2 changed files with 5 additions and 5 deletions

View File

@ -193,8 +193,8 @@ public class SysUserController extends BaseController {
for (int i = 0; i < roleIds.length; i++) {
if (roleIds[i] == 100) {
iCount = userService.countUserSchoolAdminRoleByDeptId(user.getDeptId(), roleIds[i]);
if (iCount >= 3) {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,当前学校管理员角色最多设置3");
if (iCount >= 2) {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,当前学校管理员角色最多设置2");
}
}
}
@ -254,8 +254,8 @@ public class SysUserController extends BaseController {
for (int i = 0; i < roleIds.length; i++) {
if (roleIds[i] == 100) {
iCount = userService.countUserSchoolAdminRoleByDeptId(user.getDeptId(), roleIds[i]);
if (iCount >= 3) {
return AjaxResult.error("用户'" + user.getUserName() + "'修改失败,当前学校管理员角色最多设置3");
if (iCount >= 2) {
return AjaxResult.error("用户'" + user.getUserName() + "'修改失败,当前学校管理员角色最多设置2");
}
}
}

View File

@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countUserSchoolAdminRoleByDeptId" resultType="Integer">
select count(1) from sys_user u left join sys_user_role r on u.user_id=r.user_id
where dept_id=#{deptId} and role_id=#{roleId}
where dept_id=#{deptId} and role_id=#{roleId} and u.status='0' and u.del_flag = '0'
</select>
<sql id="selectUserVo">