|
|
|
@ -196,18 +196,18 @@ public class SysUserController extends BaseController
|
|
|
|
|
@GetMapping(value = { "/", "/{userId}" })
|
|
|
|
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
|
|
|
|
{
|
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
|
|
List<SysRole> roles = roleService.selectRoleAll();
|
|
|
|
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
|
|
|
ajax.put("posts", postService.selectPostAll());
|
|
|
|
|
if (StringUtils.isNotNull(userId))
|
|
|
|
|
{
|
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
|
SysUser sysUser = userService.selectUserById(userId);
|
|
|
|
|
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
|
|
|
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
|
|
|
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
List<SysRole> roles = roleService.selectRoleAll();
|
|
|
|
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
|
|
|
ajax.put("posts", postService.selectPostAll());
|
|
|
|
|
return ajax;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|