| | |
| | | String encodePassword = passwordEncoder.encode(umsAdmin.getPassword()); |
| | | umsAdmin.setPassword(encodePassword); |
| | | baseMapper.insert(umsAdmin); |
| | | |
| | | //添加角色授权 |
| | | List<Long> ids = umsAdminParam.getRoleIds(); |
| | | if (!ids.isEmpty()) { |
| | | List<UmsAdminRoleRelation> roleIds = new ArrayList<>(); |
| | | for(Long id:ids){ |
| | | UmsAdminRoleRelation urr = new UmsAdminRoleRelation(); |
| | | urr.setAdminId(umsAdmin.getId()); |
| | | urr.setRoleId(id); |
| | | roleIds.add(urr); |
| | | } |
| | | umsAdminRoleRelationService.saveBatch(roleIds); |
| | | } |
| | | //对用户名系统默认添加 |
| | | umsAdmin.setNickName(RandomUtils.getUserId(umsAdmin.getId())); |
| | | baseMapper.updateById(umsAdmin); |
| | |
| | | if (null != umsDepart) { |
| | | e.setDepartName(umsDepart.getDepartName()); |
| | | } |
| | | //获取角色列表 |
| | | List<UmsRole> roles = umsRoleMapper.getRoleList(e.getId()); |
| | | e.setRoles(roles); |
| | | }); |
| | | } |
| | | return page1; |