| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.QaReportFileEnum; |
| | | import com.ruoyi.system.mapper.TQaReportFileMapper; |
| | | import com.ruoyi.system.mapper.TQaTestItemReportMapper; |
| | | import com.ruoyi.system.model.TQaReportFile; |
| | | import com.ruoyi.system.model.TQaTestItemReport; |
| | | import com.ruoyi.system.service.TQaTestItemReportService; |
| | | import com.ruoyi.system.vo.TQaTestItemReportVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TQaTestItemReportServiceImpl extends ServiceImpl<TQaTestItemReportMapper, TQaTestItemReport> implements TQaTestItemReportService { |
| | | |
| | | @Autowired |
| | | private TQaReportFileMapper qaReportFileMapper; |
| | | |
| | | @Override |
| | | public List<TQaTestItemReportVO> getList(String itemId) { |
| | | List<TQaTestItemReportVO> list = this.baseMapper.getList(itemId); |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | List<String> ids = list.stream().map(TQaTestItemReportVO::getId).collect(Collectors.toList()); |
| | | List<TQaReportFile> qaReportFileList = qaReportFileMapper.selectList(Wrappers.lambdaQuery(TQaReportFile.class) |
| | | .in(TQaReportFile::getReportId, ids)); |
| | | for (TQaTestItemReportVO tQaTestItemReportVO : list) { |
| | | List<TQaReportFile> qaReportFiles = qaReportFileList.stream().filter(item -> item.getReportId().equals(tQaTestItemReportVO.getId()) |
| | | && item.getReportType().equals(QaReportFileEnum.TEST_REPORT.getCode())) |
| | | .collect(Collectors.toList()); |
| | | tQaTestItemReportVO.setQaReportFileList(qaReportFiles); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |