diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java index 99bf1a2be2..1e877d107f 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java @@ -8,6 +8,7 @@ import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.base.domain.ApiScenario; import io.metersphere.base.domain.ApiScenarioExampleWithOperation; import io.metersphere.base.domain.ApiScenarioWithBLOBs; +import io.metersphere.dto.BaseCase; import io.metersphere.dto.RelationshipGraphData; import io.metersphere.request.BaseQueryRequest; import org.apache.ibatis.annotations.Param; @@ -104,4 +105,6 @@ public interface ExtApiScenarioMapper { List countByRequest(ApiCountRequest request); List relevanceScenarioList(@Param("request") ApiScenarioRequest request); + + List selectBaseCaseByProjectId(@Param("projectId") String projectId); } diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 43ea62bbc4..51af2ec8cf 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -1015,4 +1015,17 @@ + + \ No newline at end of file diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java index d414040230..e7b0f45798 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java @@ -8,6 +8,7 @@ import io.metersphere.api.dto.definition.*; import io.metersphere.base.domain.ApiDefinition; import io.metersphere.base.domain.ApiTestCase; import io.metersphere.base.domain.ApiTestCaseWithBLOBs; +import io.metersphere.dto.BaseCase; import io.metersphere.dto.ParamsDTO; import org.apache.ibatis.annotations.Param; @@ -97,4 +98,6 @@ public interface ExtApiTestCaseMapper { List countByRequest(ApiCountRequest request); List relevanceApiList(@Param("request") ApiTestCaseRequest request); + + List selectBaseCaseByProjectId(@Param("projectId") String projectId); } 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 379424e0e3..a283c1f71a 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 @@ -1147,4 +1147,15 @@ + + diff --git a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java index 925629ab2f..3f4234a58d 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiDefinitionController.java @@ -16,6 +16,7 @@ import io.metersphere.api.exec.api.ApiExecuteService; import io.metersphere.api.exec.generator.JSONSchemaGenerator; import io.metersphere.api.exec.queue.ExecThreadPoolExecutor; import io.metersphere.api.parse.api.ApiDefinitionImport; +import io.metersphere.dto.BaseCase; import io.metersphere.service.definition.ApiDefinitionService; import io.metersphere.service.definition.ApiTestCaseService; import io.metersphere.service.definition.EsbApiParamService; @@ -405,4 +406,10 @@ public class ApiDefinitionController { public void updateFileMetadataId(@RequestBody List requestList) { apiDefinitionService.updateFileMetadataId(requestList); } + + @GetMapping("/get-base-case/{projectId}") + @RequiresPermissions("PROJECT_API_DEFINITION:READ") + public List getBaseCaseByProjectId(@PathVariable String projectId) { + return apiDefinitionService.getBaseCaseByProjectId(projectId); + } } diff --git a/api-test/backend/src/main/java/io/metersphere/controller/scenario/ApiScenarioController.java b/api-test/backend/src/main/java/io/metersphere/controller/scenario/ApiScenarioController.java index 21b4745b18..4fbd209a8b 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/scenario/ApiScenarioController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/scenario/ApiScenarioController.java @@ -7,6 +7,7 @@ import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.definition.RunDefinitionRequest; import io.metersphere.api.dto.export.ScenarioToPerformanceInfoDTO; import io.metersphere.api.parse.scenario.ScenarioImport; +import io.metersphere.dto.BaseCase; import io.metersphere.service.scenario.ApiScenarioService; import io.metersphere.service.ext.ExtApiTaskService; import io.metersphere.base.domain.ApiScenario; @@ -426,5 +427,11 @@ public class ApiScenarioController { public List countScenarioCaseByRequest(@RequestBody ApiCountRequest request) { return apiAutomationService.countByRequest(request); } + + @GetMapping("/get-base-case/{projectId}") + @RequiresPermissions("PROJECT_API_SCENARIO:READ") + public List getBaseCaseByProjectId(@PathVariable String projectId) { + return apiAutomationService.getBaseCaseByProjectId(projectId); + } } diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java index 36e73be677..0b60718500 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java @@ -2889,4 +2889,8 @@ public class ApiDefinitionService { }); } } + + public List getBaseCaseByProjectId(String projectId) { + return extApiTestCaseMapper.selectBaseCaseByProjectId(projectId); + } } diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index 0c65721b92..d65697460d 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -32,6 +32,7 @@ import io.metersphere.commons.enums.ApiTestDataStatus; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.mock.MockApiUtils; +import io.metersphere.dto.BaseCase; import io.metersphere.dto.MsExecResponseDTO; import io.metersphere.dto.ProjectConfig; import io.metersphere.environment.service.BaseEnvGroupProjectService; @@ -2174,4 +2175,9 @@ public class ApiScenarioService { } return new ArrayList<>(); } + + public List getBaseCaseByProjectId(String projectId) { + return extApiScenarioMapper.selectBaseCaseByProjectId(projectId); + } + }