use of io.choerodon.agile.api.vo.WorkSpaceVO in project agile-service by open-hand.
the class WikiRelationServiceImpl method queryByIssueId.
@Override
public KnowledgeRelationVO queryByIssueId(Long projectId, Long issueId) {
WikiRelationDTO wikiRelationDTO = new WikiRelationDTO();
wikiRelationDTO.setIssueId(issueId);
List<WikiRelationDTO> wikiRelationDTOList = wikiRelationMapper.select(wikiRelationDTO);
List<WikiRelationVO> result = new ArrayList<>();
if (wikiRelationDTOList != null && !wikiRelationDTOList.isEmpty()) {
List<Long> spaceIds = wikiRelationDTOList.stream().map(WikiRelationDTO::getSpaceId).collect(Collectors.toList());
Map<Long, WorkSpaceVO> workSpaceMap = new HashMap<>();
workSpaceMap.putAll(knowledgebaseClientOperator.querySpaceByIds(projectId, spaceIds).stream().collect(Collectors.toMap(WorkSpaceVO::getId, Function.identity())));
for (WikiRelationDTO wikiRelation : wikiRelationDTOList) {
WorkSpaceVO workSpaceVO = workSpaceMap.get(wikiRelation.getSpaceId());
if (!ObjectUtils.isEmpty(workSpaceVO)) {
WikiRelationVO wikiRelationVO = new WikiRelationVO();
BeanUtils.copyProperties(wikiRelation, wikiRelationVO);
wikiRelationVO.setWorkSpaceVO(workSpaceVO);
result.add(wikiRelationVO);
}
}
}
KnowledgeRelationVO knowledgeRelation = new KnowledgeRelationVO();
knowledgeRelation.setKnowledgeRelationList(result);
return knowledgeRelation;
}
Aggregations