update 更新通过岗位ID查询用户

This commit is contained in:
AprilWind 2024-11-12 15:47:27 +08:00
parent 3bd801894d
commit 5b337b4d2f
3 changed files with 31 additions and 1 deletions

View File

@ -85,6 +85,14 @@ public interface UserService {
*/
List<UserDTO> selectUsersByDeptIds(List<Long> deptIds);
/**
* 通过岗位ID查询用户
*
* @param postIds 岗位ids
* @return 用户
*/
List<UserDTO> selectUsersByPostIds(List<Long> postIds);
/**
* 查询用户并返回任务指派的列表支持分页
*

View File

@ -696,6 +696,28 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
return BeanUtil.copyToList(list, UserDTO.class);
}
/**
* 通过岗位ID查询用户
*
* @param postIds 岗位ids
* @return 用户
*/
@Override
public List<UserDTO> selectUsersByPostIds(List<Long> postIds) {
if (CollUtil.isEmpty(postIds)) {
return List.of();
}
// 通过岗位ID获取用户岗位信息
List<SysUserPost> userPosts = userPostMapper.selectList(
new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getPostId, postIds));
// 获取用户ID列表
Set<Long> userIds = StreamUtils.toSet(userPosts, SysUserPost::getUserId);
return selectListByIds(new ArrayList<>(userIds));
}
/**
* 查询用户并返回任务指派的列表支持分页
*

View File

@ -152,7 +152,7 @@ public class WfTaskAssigneeServiceImpl implements IWfTaskAssigneeService, Handle
case USER -> userService.selectListByIds(ids);
case ROLE -> userService.selectUsersByRoleIds(ids);
case DEPT -> userService.selectUsersByDeptIds(ids);
// todo 岗位后续待添加
case POST -> userService.selectUsersByPostIds(ids);
default -> Collections.emptyList();
};
}