src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java
@@ -15,11 +15,13 @@ * 超级管理员 */ public static final String ROLE_SUPER_NAME = "超级管理员"; public static final Long ROLE_SUPER_NAME_ID = 1L; /** * 普通管理员(没有菜单管理权限和公司管理权限) */ public static final String ROLE_ADMIN_NAME = "普通管理员"; public static final Long ROLE_ADMIN_NAME_ID = 6L; //角色名称 private String roleName; src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java
@@ -51,4 +51,7 @@ @TableField(exist = false) private String roleName; @TableField(exist = false) private Long roleId; } src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java
@@ -57,9 +57,9 @@ long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId(); if(companyId > UserEntity.USER_BELONG_TOP){ userEntity.setCompanyId(companyId); userEntity.setRoleName(RoleEntity.ROLE_ADMIN_NAME); userEntity.setRoleId(RoleEntity.ROLE_ADMIN_NAME_ID); }else if(companyId == UserEntity.USER_BELONG_TOP){ userEntity.setRoleName(RoleEntity.ROLE_SUPER_NAME); userEntity.setRoleId(RoleEntity.ROLE_SUPER_NAME_ID); } if(StrUtil.isNotEmpty(adminUserDto.getUsername())){ userEntity.setUsername(adminUserDto.getUsername()); src/main/resources/mapper/UserMapper.xml
@@ -11,7 +11,7 @@ <where> and a.id not in ( SELECT b.user_id FROM t_user_role b WHERE b.role_id in ( SELECT id FROM t_role WHERE role_name = #{record.roleName}) WHERE b.role_id in ( SELECT id FROM t_role WHERE role_id = #{record.roleId}) ) <if test="record != null" > <if test="record.username!=null">