From 17da33c4649c53d9895ea56ee4751f90ded33f4d Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 25 Jan 2022 16:17:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=95=B0=E9=87=8F=E4=B8=8D=E8=83=BD=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/service/ApiDefinitionService.java | 2 +- .../base/mapper/ext/ExtApiDefinitionMapper.xml | 10 ++++++++-- .../base/mapper/ext/ExtApiScenarioMapper.xml | 4 ++-- .../base/mapper/ext/ExtApiScenarioReportMapper.xml | 4 ++-- .../base/mapper/ext/ExtApiTestCaseMapper.xml | 3 ++- .../metersphere/base/mapper/ext/ExtScheduleMapper.xml | 6 +++--- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 71d9cf7eec..12c705a7ec 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1780,7 +1780,7 @@ public class ApiDefinitionService { return 0; } else { ApiDefinitionExample example = new ApiDefinitionExample(); - example.createCriteria().andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash"); + example.createCriteria().andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash").andLatestEqualTo(true); return apiDefinitionMapper.countByExample(example); } } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml index 2d1728847b..3293d8f73c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml @@ -344,7 +344,12 @@ select id,path,method from api_definition - WHERE project_id = #{0} AND status != 'Trash' AND protocol = 'HTTP' + WHERE project_id = #{0} AND status != 'Trash' AND protocol = 'HTTP' AND latest = 1 - SELECT COUNT(DISTINCT ref_id) AS countNumber FROM api_scenario WHERE project_id = #{0} AND status != 'Trash' + SELECT COUNT(DISTINCT ref_id) AS countNumber FROM api_scenario WHERE project_id = #{0} AND status != 'Trash' AND latest = 1 @@ -239,7 +239,7 @@ SELECT count(ar.id) AS countNumber,ar.status AS groupField FROM api_scenario_report ar INNER JOIN ( - SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id + SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id and latest = 1 ) ac on ar.scenario_id = ac.id WHERE ar.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE' GROUP BY groupField; diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index f4b6d9a77a..16b22e8163 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -542,7 +542,7 @@