fix(测试跟踪): 查询测试计划报错

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-03-30 19:17:43 +08:00 committed by 刘瑞斌
parent f9c73ff4e8
commit cfe0ac2b39
2 changed files with 7 additions and 4 deletions

View File

@ -27,10 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -92,6 +89,9 @@ public class ScheduleService {
public List<Schedule> getScheduleByResourceIds(List<String>resourceIds, String group) {
ScheduleExample example = new ScheduleExample();
if(resourceIds.size()==0){
return new ArrayList<>();
}
example.createCriteria().andResourceIdIn(resourceIds).andGroupEqualTo(group);
List<Schedule> schedules = scheduleMapper.selectByExample(example);
if (schedules.size() > 0) {

View File

@ -429,6 +429,9 @@ public class TestPlanService {
request.setProjectId(request.getProjectId());
}
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
if(testPlans.size()==0){
return new ArrayList<>();
}
Set<String> ids = testPlans.stream().map(TestPlan::getId).collect(Collectors.toSet());
Map<String, ParamsDTO> planTestCaseCountMap = extTestPlanMapper.testPlanTestCaseCount(ids);
Map<String, ParamsDTO> planApiCaseMap = extTestPlanMapper.testPlanApiCaseCount(ids);