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