From 4ed5027367f84943563d4c83588b93afa310a4b8 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Thu, 1 Apr 2021 17:32:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA=EF=BC=8C=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=88=97=E8=A1=A8=E6=A0=87=E7=AD=BE=E5=92=8C?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=AC=A1=E6=95=B0=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/track/service/TestPlanReportService.java | 4 ---- .../io/metersphere/track/service/TestPlanService.java | 9 ++++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index 3d044fcb22..b367467eaa 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -88,10 +88,6 @@ public class TestPlanReportService { */ public TestPlanReport genTestPlanReport(TestPlanReportSaveRequest saveRequest) { TestPlan testPlan = testPlanMapper.selectByPrimaryKey(saveRequest.getPlanId()); - testPlan.setExecutionTimes(1); - testPlan.setExecutionTimes(testPlan.getExecutionTimes() + 1); - testPlanMapper.updateByPrimaryKey(testPlan); - String testPlanReportID = saveRequest.getReportID(); TestPlanReport testPlanReport = new TestPlanReport(); testPlanReport.setTestPlanId(saveRequest.getPlanId()); 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 e1da5af7a8..2c1ee4d556 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -122,7 +122,7 @@ public class TestPlanService { @Resource private ApiDefinitionMapper apiDefinitionMapper; @Resource - private TestPlanApiCaseMapper testPlanApiCaseMapper; + private TestPlanApiCaseMapper testPlanApiCaseMapper; @Resource private TestPlanApiScenarioMapper testPlanApiScenarioMapper; @Resource @@ -131,6 +131,8 @@ public class TestPlanService { private TestCaseTestMapper testCaseTestMapper; @Resource private ApiScenarioReportMapper apiScenarioReportMapper; + @Resource + private TestPlanReportMapper testPlanReportMapper; public synchronized String addTestPlan(AddTestPlanRequest testPlan) { if (getTestPlanByName(testPlan.getName()).size() > 0) { @@ -385,6 +387,11 @@ public class TestPlanService { request.setProjectId(projectId); } List testPlans = extTestPlanMapper.list(request); + testPlans.forEach(item -> { + TestPlanReportExample example = new TestPlanReportExample(); + example.createCriteria().andTestPlanIdEqualTo(item.getId()); + item.setExecutionTimes((int) testPlanReportMapper.countByExample(example)); + }); calcTestPlanRate(testPlans); return testPlans; }