diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index f37aaf53e4..52c7ac385e 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -44,13 +44,6 @@ public class ApiAutomationController { return PageUtils.setPageInfo(page, apiAutomationService.list(request)); } - @PostMapping("/list/all") - @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) - public List list(@RequestBody ApiScenarioRequest request) { - request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); - return apiAutomationService.get(request); - } - @PostMapping(value = "/create") public ApiScenario create(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "files") List bodyFiles) { return apiAutomationService.create(request, bodyFiles); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 0436a9c0d6..027fe93ec5 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -720,16 +720,6 @@ public class ApiAutomationService { } } - public List get(ApiScenarioRequest request) { - ApiScenarioExample example = new ApiScenarioExample(); - if (CollectionUtils.isNotEmpty(request.getIds())) { - example.createCriteria().andIdIn(request.getIds()); - } else { - example.createCriteria().andProjectIdEqualTo(request.getProjectId()); - } - return apiScenarioMapper.selectByExampleWithBLOBs(example); - } - public List getWithBLOBs(ApiScenarioWithBLOBs request) { ApiScenarioExample example = new ApiScenarioExample(); example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andStatusNotEqualTo("Trash").andIdNotEqualTo(request.getId()); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDocumentMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDocumentMapper.xml index d0e9515f31..655c980f30 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDocumentMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDocumentMapper.xml @@ -5,13 +5,13 @@ SELECT api.id,api.name FROM Api_definition api - api.project_Id = #{request.projectId} + AND api.project_Id = #{request.projectId} - - api.project_Id like CONCAT('%', #{request.name},'%') + + AND api.name like CONCAT('%', #{request.name},'%') - - api.method = #{request.type} + + AND api.method = #{request.type} diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index 58b6240c65..44ee0dafdc 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -131,25 +131,7 @@ }, methods: { exportAPI() { - let obj = {projectName: localStorage.getItem(PROJECT_NAME)} - let condition = {projectId: getCurrentProjectID(), ids: this.$refs.apiScenarioList.selection}; - let url = "/api/automation/list/all"; - this.loading = true; - this.$post(url, condition, response => { - obj.data = response.data; - this.buildApiPath(obj.data); - this.loading = false; - downloadFile("Metersphere_Scenario_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj)); - }); - }, - buildApiPath(apis) { - apis.forEach((api) => { - this.moduleOptions.forEach(item => { - if (api.moduleId === item.id) { - api.modulePath = item.path; - } - }); - }); + this.$refs.apiScenarioList.exportApi(); }, checkRedirectEditPage(redirectParam) { if (redirectParam != null) { diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index d9fbdd4b8d..317795503a 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -187,7 +187,7 @@ import {PROJECT_NAME} from "../../../../../common/js/constants"; import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect"; import BatchMove from "../../../track/case/components/BatchMove"; import {_sort} from "@/common/js/tableUtils"; -import {Api_Scenario_List, Track_Test_Case} from "@/business/components/common/model/JsonData"; +import {Api_Scenario_List} from "@/business/components/common/model/JsonData"; import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import { _filter, diff --git a/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue b/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue index 6b2c0e1925..4a4488eb60 100644 --- a/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue +++ b/frontend/src/business/components/api/definition/components/document/ApiDocumentItem.vue @@ -384,6 +384,7 @@ export default { } let simpleInfoUrl = "/api/document/selectApiSimpleInfo"; + this.apiSimpleInfoArray = []; this.$post(simpleInfoUrl, simpleRequest, response => { this.apiSimpleInfoArray = response.data; this.apiStepIndex = 0;