|
|
@@ -102,7 +102,19 @@ public class APITestServiceImpl implements APITestService {
|
|
|
|
|
|
@Override
|
|
|
public List<APITestResultVO> getAPITestResultByTestId(Integer testId) {
|
|
|
- List<TestResult> testResultVOS = apiTestMapper.selectTestResultByTestId(testId);
|
|
|
+
|
|
|
+ TestInfo testInfo = apiTestMapper.selectByTestId(testId);
|
|
|
+
|
|
|
+ //获取最新的部署构建信息id
|
|
|
+ List<Integer> pipelineIds = pipelineMapper.selectByProjectId(testInfo.getProjectId()).stream().map(PipelinePO::getId).collect(Collectors.toList());
|
|
|
+ PipelineRecordPO latestRecord;
|
|
|
+ if (pipelineIds.size() == 0){
|
|
|
+ latestRecord = null;
|
|
|
+ } else {
|
|
|
+ latestRecord = pipelineRecordMapper.selectPipelinesLatestRecord(pipelineIds);
|
|
|
+ }
|
|
|
+ Integer recordId = latestRecord==null? -1:latestRecord.getId();
|
|
|
+ List<TestResult> testResultVOS = apiTestMapper.selectTestResultByTestId(testId, recordId);
|
|
|
List<APITestResultVO> apiTestResultVOList = new ArrayList<>();
|
|
|
for (TestResult testResult: testResultVOS) {
|
|
|
apiTestResultVOList.add(new APITestResultVO(transform1(testResult)));
|
|
|
@@ -112,7 +124,18 @@ public class APITestServiceImpl implements APITestService {
|
|
|
|
|
|
@Override
|
|
|
public APITestResultVO getLatestTestResultByTestId(Integer testId) {
|
|
|
- TestResult testResult = apiTestMapper.selectLatestTestResultById(testId);
|
|
|
+ TestInfo testInfo = apiTestMapper.selectByTestId(testId);
|
|
|
+
|
|
|
+ List<Integer> pipelineIds = pipelineMapper.selectByProjectId(testInfo.getProjectId()).stream().map(PipelinePO::getId).collect(Collectors.toList());
|
|
|
+ PipelineRecordPO latestRecord;
|
|
|
+ if (pipelineIds.size() == 0){
|
|
|
+ latestRecord = null;
|
|
|
+ } else {
|
|
|
+ latestRecord = pipelineRecordMapper.selectPipelinesLatestRecord(pipelineIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ TestResult testResult = apiTestMapper.selectLatestTestResultById(testId, latestRecord==null?-1:latestRecord.getId());
|
|
|
+
|
|
|
if (testResult == null) {
|
|
|
return null;
|
|
|
}
|