Skip to content

Commit

Permalink
fix: get sys_user info (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
k8scat authored Feb 21, 2024
1 parent 3691aa2 commit 0c7de21
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0c7de21

Please sign in to comment.