From 78a1e9deb6b7163a9d73a3645de6522367fd2638 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 28 Feb 2023 14:44:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=A0=91=E5=8A=A0=E8=BD=BD=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1011189 --user=赵勇 系统左侧模块树加载效率优化 https://www.tapd.cn/55049933/s/1343693 --- .../mapper/ext/ExtApiDefinitionMapper.java | 28 +------ .../mapper/ext/ExtApiDefinitionMapper.xml | 77 ++----------------- .../service/definition/ApiModuleService.java | 50 +----------- 3 files changed, 11 insertions(+), 144 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 66b1cbf281..24ec92dba3 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 @@ -1,40 +1,26 @@ package io.metersphere.base.mapper.ext; import io.metersphere.api.dto.datacount.ApiDataCountResult; -import io.metersphere.api.dto.definition.ApiComputeResult; -import io.metersphere.api.dto.definition.ApiDefinitionRequest; -import io.metersphere.api.dto.definition.ApiDefinitionResult; -import io.metersphere.api.dto.definition.ApiSwaggerUrlDTO; +import io.metersphere.api.dto.definition.*; import io.metersphere.base.domain.*; import io.metersphere.dto.RelationshipGraphData; import io.metersphere.request.BaseQueryRequest; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; import java.util.Set; public interface ExtApiDefinitionMapper { - List selectScheduleList(@Param("projectId") String projectId); - List list(@Param("request") ApiDefinitionRequest request); - List apiList(@Param("request") ApiDefinitionRequest request); - List weekList(@Param("request") ApiDefinitionRequest request, @Param("startTimestamp") long startTimestamp); List scenarioList(@Param("apiDefinitionId") String apiDefinitionId); - int moduleCount(@Param("request") ApiDefinitionRequest request); - - //List selectByIds(@Param("ids") List ids); - List selectByIds(@Param("ids") List ids, @Param("projectId") String projectId); List selectByIdsAndStatusIsNotTrash(@Param("ids") List ids, @Param("projectId") String projectId); - // int removeToGc(@Param("ids") List ids); - int removeToGcByExample(ApiDefinitionExampleWithOperation example); int reduction(@Param("ids") List ids); @@ -59,14 +45,10 @@ public interface ExtApiDefinitionMapper { List listByIds(@Param("ids") List ids); - List> moduleCountByCollection(@Param("request") ApiDefinitionRequest request); - - ApiDefinition selectUrlAndMethodById(String id); + List moduleCountByCollection(@Param("request") ApiDefinitionRequest request); int checkOriginalStatusByIds(@Param("ids") List ids); - List selectProjectIds(); - List getIdsOrderByUpdateTime(@Param("projectId") String projectId); Long getPreOrder(@Param("projectId") String projectId, @Param("baseOrder") Long baseOrder); @@ -87,20 +69,14 @@ public interface ExtApiDefinitionMapper { void updateVersionModule(@Param("refId") String refId, @Param("versionId") String versionId, @Param("moduleId") String moduleId, @Param("modulePath") String modulePath); - List selectRefIdsForVersionChange(@Param("versionId") String versionId, @Param("projectId") String projectId); - String selectNameById(String testId); - int toBeUpdateApi(@Param("ids") List ids, @Param("toBeUpdate") Boolean toBeUpdate); - List selectRepeatByBLOBs(@Param("blobs") List blobs, @Param("projectId") String projectId); List selectRepeatByBLOBsSameUrl(@Param("blobs") List blobs, @Param("projectId") String projectId, @Param("moduleId") String moduleId); List selectRepeatByProtocol(@Param("names") List names, @Param("protocol") String protocol, @Param("projectId") String projectId); - int countById(String id); - List selectEffectiveIdByProjectIdAndHaveNotCase(@Param("projectId") String projectId, @Param("versionId") String versionId); int deleteApiToGc(ApiDefinitionRequest request); 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 ff8efe9324..7182161a46 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 @@ -460,11 +460,7 @@ WHERE api_definition.project_id = #{projectId} ORDER BY num DESC LIMIT 1; - + - - - + select module_id AS id,count(id) AS caseNum from api_definition GROUP BY module_id @@ -1008,10 +985,6 @@ - - + - SELECT DISTINCT ref_id - FROM api_definition - WHERE ref_id NOT IN (SELECT DISTINCT ref_id - FROM api_definition - WHERE version_id = #{versionId} - AND project_id = #{projectId}) - AND project_id = #{projectId} - - +