From aec36b26130d21207edb9cb81c3c696ce2b3b6a7 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 12 Apr 2023 11:18:53 +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=E7=94=A8=E4=BE=8B=E9=9D=A2=E6=9D=BF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BD=93=E6=95=B0=E6=8D=AE=E9=87=8F=E5=8F=98=E5=A4=9A=E6=97=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=80=9F=E5=BA=A6=E8=BE=83=E6=85=A2=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025067 --user=宋天阳 【接口测试】首页-接口用例数量统计-接口响应很慢 https://www.tapd.cn/55049933/s/1361757 --- .../mapper/ext/ExtApiDefinitionMapper.java | 2 +- .../mapper/ext/ExtApiDefinitionMapper.xml | 104 ++++++++---------- .../base/mapper/ext/ExtApiTestCaseMapper.xml | 21 ++-- .../controller/home/ApiHomeController.java | 3 +- .../definition/ApiDefinitionService.java | 29 ++++- .../definition/ApiTestCaseService.java | 24 +++- 6 files changed, 105 insertions(+), 78 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java index b2a69a7869..b1f2861764 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.java @@ -32,7 +32,7 @@ public interface ExtApiDefinitionMapper { List countStateByProjectID(@Param("projectId") String projectId, @Param("versionId") String versionId); - List countApiCoverageByProjectID(@Param("projectId") String projectId, @Param("versionId") String versionId); + List countApiHasNotCaseByProjectID(@Param("projectId") String projectId, @Param("versionId") String versionId); ApiDefinition getNextNum(@Param("projectId") String projectId); diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml index b1df357a83..3bc2dbe4b3 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionMapper.xml @@ -119,7 +119,8 @@ - + SELECT count(api.id) AS countNumber, 'unCovered' AS groupField FROM api_definition api WHERE api.project_id = #{projectId} - and api.`status` != 'Trash' + AND api.`status` != 'Trash' + AND api.id NOT IN ( SELECT DISTINCT api_definition_id FROM api_test_case WHERE STATUS IS NULL OR STATUS != + 'Trash' ) and api.version_id = #{versionId} and api.latest = 1 - GROUP BY groupField diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index 7a79891a5d..b6bcce746e 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -1031,16 +1031,14 @@