update 优化用户编号获取详细信息岗位查询

This commit is contained in:
AprilWind 2024-04-24 13:41:21 +08:00
parent 2a2204d535
commit 429a2a4810
3 changed files with 13 additions and 6 deletions

View File

@ -24,6 +24,7 @@ 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.*;
@ -137,9 +138,13 @@ public class SysUserController extends BaseController {
SysUserVo sysUser = userService.selectUserById(userId);
userInfoVo.setUser(sysUser);
userInfoVo.setRoleIds(roleService.selectRoleListByUserId(userId));
List<SysPostVo> sysPostVos = postService.selectPostListByUserId(userId);
userInfoVo.setPosts(sysPostVos);
userInfoVo.setPostIds(StreamUtils.toList(sysPostVos, SysPostVo::getPostId));
Long deptId = sysUser.getDeptId();
if (ObjectUtil.isNotNull(deptId)) {
SysPostBo postBo = new SysPostBo();
postBo.setDeptId(deptId);
userInfoVo.setPosts(postService.selectPostList(postBo));
userInfoVo.setPostIds(postService.selectPostListByUserId(userId));
}
}
return R.ok(userInfoVo);
}

View File

@ -46,7 +46,7 @@ public interface ISysPostService {
* @param userId 用户ID
* @return 选中岗位ID列表
*/
List<SysPostVo> selectPostListByUserId(Long userId);
List<Long> selectPostListByUserId(Long userId);
/**
* 通过岗位ID串查询岗位

View File

@ -9,6 +9,7 @@ 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;
@ -118,8 +119,9 @@ public class SysPostServiceImpl implements ISysPostService {
* @return 选中岗位ID列表
*/
@Override
public List<SysPostVo> selectPostListByUserId(Long userId) {
return baseMapper.selectPostsByUserId(userId);
public List<Long> selectPostListByUserId(Long userId) {
List<SysPostVo> list = baseMapper.selectPostsByUserId(userId);
return StreamUtils.toList(list, SysPostVo::getPostId);
}
/**