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 @@