xuhy
3 天以前 9cb78a5414cdbfdd59931b14759bf9800d275448
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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.basic.PageInfo;
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.query.TQaTestItemReportQuery;
import com.ruoyi.system.service.TQaTestItemReportService;
import com.ruoyi.system.vo.TExperimentSchemeVO;
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>
 * QA检测项报告 服务实现类
 * </p>
 *
 * @author xiaochen
 * @since 2025-04-08
 */
@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;
    }
 
    @Override
    public PageInfo<TQaTestItemReportVO> pageList(TQaTestItemReportQuery query) {
        PageInfo<TQaTestItemReportVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TQaTestItemReportVO> list = this.baseMapper.pageList(query,pageInfo);
        pageInfo.setRecords(list);
        return pageInfo;
    }
}