我的部门下面的用户分配角色报错(无角色的情况下)

pull/3201/head
zhangdaiscott 3 years ago
parent 42e0a938da
commit c767f094fc

@ -205,7 +205,10 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
List<SysDepartRole> roleList = sysDepartRoleService.list(new QueryWrapper<SysDepartRole>().eq("depart_id",departId)); List<SysDepartRole> roleList = sysDepartRoleService.list(new QueryWrapper<SysDepartRole>().eq("depart_id",departId));
List<String> roleIds = roleList.stream().map(SysDepartRole::getId).collect(Collectors.toList()); List<String> roleIds = roleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
//根据角色id,用户id查询已授权角色 //根据角色id,用户id查询已授权角色
List<SysDepartRoleUser> roleUserList = departRoleUserService.list(new QueryWrapper<SysDepartRoleUser>().eq("user_id",userId).in("drole_id",roleIds)); List<SysDepartRoleUser> roleUserList = null;
if(roleIds!=null && roleIds.size()>0){
roleUserList = departRoleUserService.list(new QueryWrapper<SysDepartRoleUser>().eq("user_id",userId).in("drole_id",roleIds));
}
result.setSuccess(true); result.setSuccess(true);
result.setResult(roleUserList); result.setResult(roleUserList);
return result; return result;

Loading…
Cancel
Save