!133 减少一次sql查询(SysUser对象包含了角色列表)

Merge pull request !133 from runphp/N/A
pull/130/MERGE
若依 3 years ago committed by Gitee
commit 2b42931486

@ -179,9 +179,10 @@ public class SysUserController extends BaseController
ajax.put("posts", postService.selectPostAll()); ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
} }
return ajax; return ajax;
} }

Loading…
Cancel
Save