mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
update 优化根据用户编号获取详细信息
This commit is contained in:
parent
e2d6a67c4f
commit
0f7253a4b3
@ -24,7 +24,6 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.domain.bo.SysPostBo;
|
||||
import org.dromara.system.domain.bo.SysRoleBo;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.*;
|
||||
@ -132,16 +131,15 @@ public class SysUserController extends BaseController {
|
||||
SysUserInfoVo userInfoVo = new SysUserInfoVo();
|
||||
SysRoleBo roleBo = new SysRoleBo();
|
||||
roleBo.setStatus(UserConstants.ROLE_NORMAL);
|
||||
SysPostBo postBo = new SysPostBo();
|
||||
postBo.setStatus(UserConstants.POST_NORMAL);
|
||||
List<SysRoleVo> roles = roleService.selectRoleList(roleBo);
|
||||
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
|
||||
userInfoVo.setPosts(postService.selectPostList(postBo));
|
||||
if (ObjectUtil.isNotNull(userId)) {
|
||||
SysUserVo sysUser = userService.selectUserById(userId);
|
||||
userInfoVo.setUser(sysUser);
|
||||
userInfoVo.setRoleIds(roleService.selectRoleListByUserId(userId));
|
||||
userInfoVo.setPostIds(postService.selectPostListByUserId(userId));
|
||||
List<SysPostVo> sysPostVos = postService.selectPostListByUserId(userId);
|
||||
userInfoVo.setPosts(sysPostVos);
|
||||
userInfoVo.setPostIds(StreamUtils.toList(sysPostVos, SysPostVo::getPostId));
|
||||
}
|
||||
return R.ok(userInfoVo);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public interface ISysPostService {
|
||||
* @param userId 用户ID
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
List<Long> selectPostListByUserId(Long userId);
|
||||
List<SysPostVo> selectPostListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过岗位ID串查询岗位
|
||||
|
||||
@ -9,7 +9,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -119,9 +118,8 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectPostListByUserId(Long userId) {
|
||||
List<SysPostVo> list = baseMapper.selectPostsByUserId(userId);
|
||||
return StreamUtils.toList(list, SysPostVo::getPostId);
|
||||
public List<SysPostVo> selectPostListByUserId(Long userId) {
|
||||
return baseMapper.selectPostsByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectPostsByUserId" parameterType="Long" resultMap="SysPostResult">
|
||||
select p.post_id, p.post_name, p.post_code ,p.post_category
|
||||
select p.post_id, p.dept_id, p.post_name, p.post_code, p.post_category
|
||||
from sys_post p
|
||||
left join sys_user_post up on up.post_id = p.post_id
|
||||
left join sys_user u on u.user_id = up.user_id
|
||||
|
||||
Loading…
Reference in New Issue
Block a user