From cfe0ac2b396b3ff7b3ca59ac045c5db9845533a4 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 30 Mar 2022 19:17:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --- .../main/java/io/metersphere/service/ScheduleService.java | 8 ++++---- .../io/metersphere/track/service/TestPlanService.java | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/ScheduleService.java b/backend/src/main/java/io/metersphere/service/ScheduleService.java index 7b0349a479..9e3ec165bb 100644 --- a/backend/src/main/java/io/metersphere/service/ScheduleService.java +++ b/backend/src/main/java/io/metersphere/service/ScheduleService.java @@ -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 getScheduleByResourceIds(ListresourceIds, String group) { ScheduleExample example = new ScheduleExample(); + if(resourceIds.size()==0){ + return new ArrayList<>(); + } example.createCriteria().andResourceIdIn(resourceIds).andGroupEqualTo(group); List schedules = scheduleMapper.selectByExample(example); if (schedules.size() > 0) { diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 85e97e028c..5d1668db8d 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -429,6 +429,9 @@ public class TestPlanService { request.setProjectId(request.getProjectId()); } List testPlans = extTestPlanMapper.list(request); + if(testPlans.size()==0){ + return new ArrayList<>(); + } Set ids = testPlans.stream().map(TestPlan::getId).collect(Collectors.toSet()); Map planTestCaseCountMap = extTestPlanMapper.testPlanTestCaseCount(ids); Map planApiCaseMap = extTestPlanMapper.testPlanApiCaseCount(ids);