From 0c7de2127008d2dafbdfc7a4cb44f6017762239d Mon Sep 17 00:00:00 2001 From: K8sCat Date: Wed, 21 Feb 2024 09:24:22 +0800 Subject: [PATCH] fix: get sys_user info (#298) --- .../campus/admin/controller/system/SysUserController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;