提交 4bdaf214 authored 作者: gongwenjie's avatar gongwenjie

接口注释,人员部分代码

上级 e79d0035
...@@ -49,8 +49,10 @@ public class MyUserDetailsServiceImpl implements UserDetailsService { ...@@ -49,8 +49,10 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
if(user!=null){ if(user!=null){
List<UserRole> userRoles = userRoleDao.findAllByUserId(user.getId()); List<UserRole> userRoles = userRoleDao.findAllByUserId(user.getId());
List<String> roleIds = new ArrayList<>(); List<String> roleIds = new ArrayList<>();
for (UserRole userRole : userRoles) { if(userRoles!=null){
roleIds.add(userRole.getRoleId()); for (UserRole userRole : userRoles) {
roleIds.add(userRole.getRoleId());
}
} }
user.setUsername(username); user.setUsername(username);
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword())); user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
...@@ -58,11 +60,14 @@ public class MyUserDetailsServiceImpl implements UserDetailsService { ...@@ -58,11 +60,14 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
List<Role> roles = roleDao.findAllByIdIn(roleIds); List<Role> roles = roleDao.findAllByIdIn(roleIds);
List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleIdIn(roleIds); List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleIdIn(roleIds);
List<String> authorityIds = new ArrayList<>(); List<String> authorityIds = new ArrayList<>();
for (RoleAuthority roleAuthority : roleAuthorities) { if(roleAuthorities!=null){
if(!authorityIds.contains(roleAuthority.getAuthorityId())){ for (RoleAuthority roleAuthority : roleAuthorities) {
authorityIds.add(roleAuthority.getAuthorityId()); if(!authorityIds.contains(roleAuthority.getAuthorityId())){
authorityIds.add(roleAuthority.getAuthorityId());
}
} }
} }
List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds); List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds);
authorities.forEach(authority -> { authorities.forEach(authority -> {
list.add(new SimpleGrantedAuthority(authority.getName())); list.add(new SimpleGrantedAuthority(authority.getName()));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论