| | |
| | | } |
| | | //对用户名系统默认添加 |
| | | //umsAdmin.setNickName(RandomUtils.getUserId(umsAdmin.getId())); |
| | | baseMapper.updateById(umsAdmin); |
| | | //添加部门 |
| | | UmsDepartManage departManage = new UmsDepartManage(); |
| | | departManage.setUserId(umsAdmin.getId()); |
| | | departManage.setDepartId(umsAdmin.getDepartmentId()); |
| | | departManage.setCreateTime(new Date()); |
| | | departManage.setUpdateTime(new Date()); |
| | | umsDepartManageMapper.insert(departManage); |
| | | |
| | | baseMapper.updateById(umsAdmin); |
| | | return umsAdmin; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UmsResource> getResourceList(Long adminId) { |
| | | List<UmsResource> resourceList = getCacheService().getResourceList(adminId); |
| | | if (CollUtil.isNotEmpty(resourceList)) { |
| | | return resourceList; |
| | | public List<UmsMenu> getResourceList(Long adminId) { |
| | | List<UmsMenu> umsMenuList = getCacheService().getResourceList(adminId); |
| | | if (CollUtil.isNotEmpty(umsMenuList)) { |
| | | return umsMenuList; |
| | | } |
| | | resourceList = umsResourceMapper.getResourceList(adminId); |
| | | if (CollUtil.isNotEmpty(resourceList)) { |
| | | getCacheService().setResourceList(adminId, resourceList); |
| | | } |
| | | return resourceList; |
| | | umsMenuList = umsMenuMapper.getMenuList(adminId); |
| | | getCacheService().setResourceList(adminId, umsMenuList); |
| | | return umsMenuList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | //获取用户信息 |
| | | UmsAdmin admin = getAdminByUsername(username); |
| | | if (admin != null) { |
| | | List<UmsResource> resourceList = getResourceList(admin.getId()); |
| | | List<UmsMenu> resourceList = getResourceList(admin.getId()); |
| | | return new AdminUserDetails(admin, resourceList); |
| | | } |
| | | throw new UsernameNotFoundException("用户名或密码错误"); |