diff --git a/campus-admin/src/main/java/com/oddfar/campus/admin/controller/system/SysUserController.java b/campus-admin/src/main/java/com/oddfar/campus/admin/controller/system/SysUserController.java index 4072106..0d40423 100644 --- a/campus-admin/src/main/java/com/oddfar/campus/admin/controller/system/SysUserController.java +++ b/campus-admin/src/main/java/com/oddfar/campus/admin/controller/system/SysUserController.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -59,7 +60,7 @@ public R getInfo(@PathVariable(value = "userId", required = false) Long userId) if (StringUtils.isNotNull(userId)) { SysUserEntity sysUser = userService.selectUserById(userId); res.put("data", sysUser); - res.put("roleIds", sysUser.getRoles().stream().map(SysRoleEntity::getRoleId).collect(Collectors.toList())); + res.put("roleIds", sysUser.getRoles().stream().map(SysRoleEntity::getRoleId).filter(Objects::nonNull).collect(Collectors.toList())); } return res;