| | |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | Page<AdminUserVo> page = new Page<>(adminUserDto.getPageNum(), adminUserDto.getPageSize()); |
| | | UserEntity userEntity = new UserEntity(); |
| | | long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId(); |
| | | if(belongId > UserEntity.USER_BELONG_TOP){ |
| | | userEntity.setBelongId(belongId); |
| | | 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); |
| | | }else if(belongId == UserEntity.USER_BELONG_TOP){ |
| | | }else if(companyId == UserEntity.USER_BELONG_TOP){ |
| | | userEntity.setRoleName(RoleEntity.ROLE_SUPER_NAME); |
| | | } |
| | | if(StrUtil.isNotEmpty(adminUserDto.getUsername())){ |
| | |
| | | } |
| | | userEntity.setPassword(SecureUtil.md5(UserEntity.PASSWORD_DEFAULT)); |
| | | userEntity.setStatus(UserEntity.STATUS_ENABLE); |
| | | userEntity.setBelongId(belongId); |
| | | userEntity.setCompanyId(belongId); |
| | | int insert = this.baseMapper.insert(userEntity); |
| | | if(insert > 0){ |
| | | saveUserRole(roleIds,userEntity.getId()); |
| | |
| | | adminSeeUserInfoVo.setNickname(userEntity.getNickname()); |
| | | adminSeeUserInfoVo.setPhone(userEntity.getPhone()); |
| | | adminSeeUserInfoVo.setEmail(userEntity.getEmail()); |
| | | adminSeeUserInfoVo.setBelongId(userEntity.getBelongId()); |
| | | adminSeeUserInfoVo.setBelongId(userEntity.getCompanyId()); |
| | | |
| | | List<AdminRoleVo> adminRoleVos = new ArrayList<>(); |
| | | QueryWrapper<UserRoleEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | |
| | | if(ObjectUtil.isEmpty(userEntity)){ |
| | | return Result.fail("用户不存在"); |
| | | } |
| | | userEntity.setBelongId(belongId); |
| | | userEntity.setCompanyId(belongId); |
| | | userEntity.setUsername(username); |
| | | userEntity.setPhone(phone); |
| | | if(StrUtil.isNotEmpty(adminUpdateUserDto.getNickname())){ |
| | |
| | | List<UserRoleEntity> userRoleEntities = userRoleMapper.selectList(userRoleQueryWrapper); |
| | | if(CollUtil.isNotEmpty(userRoleEntities)){ |
| | | List menuIds = new ArrayList<Long>(); |
| | | for(UserRoleEntity userRoleEntity : userRoleEntities){ |
| | | List<RoleMenuEntity> roleMenuEntities = roleMenuMapper.selectListByRoleId(userRoleEntity.getRoleId()); |
| | | if(CollUtil.isNotEmpty(roleMenuEntities)){ |
| | | for(RoleMenuEntity roleMenuEntity : roleMenuEntities){ |
| | | menuIds.add(roleMenuEntity.getMenuId()); |
| | | if(UserEntity.USERNAME_DEFAULT.equals(loginUser.getUsername())){ |
| | | List<MenuEntity> menuEntities = menuMapper.selectList(new QueryWrapper<>()); |
| | | if(CollUtil.isNotEmpty(menuEntities)){ |
| | | for(MenuEntity menuEntity : menuEntities){ |
| | | menuIds.add(menuEntity.getId()); |
| | | } |
| | | } |
| | | }else{ |
| | | for(UserRoleEntity userRoleEntity : userRoleEntities){ |
| | | List<RoleMenuEntity> roleMenuEntities = roleMenuMapper.selectListByRoleId(userRoleEntity.getRoleId()); |
| | | if(CollUtil.isNotEmpty(roleMenuEntities)){ |
| | | for(RoleMenuEntity roleMenuEntity : roleMenuEntities){ |
| | | menuIds.add(roleMenuEntity.getMenuId()); |
| | | } |
| | | } |
| | | } |
| | | } |