提交 9800aa16 authored 作者: gongwenjie's avatar gongwenjie

合并分支 'gwj' 到 'master'

Gwj 查看合并请求 !13
流水线 #19 已失败 于阶段
......@@ -96,7 +96,7 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
}
redisTemplate.opsForValue().set(user.getUsername(),0);
// redisTemplate.opsForValue().set(user.getUsername(),0);
if(("root").equals(user.getUsername())){
user = init.root;
}else{
......
......@@ -39,7 +39,18 @@ public class RoleServiceImpl implements IRoleService {
@Override
public Role findRoleById(String id) {
Role role = null;
Optional<Role> byId = roleDao.findById(id);
List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleId(id);
List<String> authorityIds = new ArrayList<>();
for (RoleAuthority roleAuthority : roleAuthorities) {
authorityIds.add(roleAuthority.getAuthorityId());
}
List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds);
if(byId.isPresent()){
role = byId.get();
role.setAuthorities(authorities);
}
return byId.get();
}
......@@ -97,7 +108,17 @@ public class RoleServiceImpl implements IRoleService {
@Override
public List<Role> findRoleByDepartId(String id) {
return roleDao.findAllByDepartmentId(id);
List<Role> roles = roleDao.findAllByDepartmentId(id);
for (Role role : roles) {
List<String> authorityIds = new ArrayList<>();
List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleId(role.getId());
for (RoleAuthority roleAuthority : roleAuthorities) {
authorityIds.add(roleAuthority.getAuthorityId());
}
List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds);
role.setAuthorities(authorities);
}
return roles;
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论