From d7b94fea5131f2eeee10843a5c282a64d6c3b714 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Fri, 13 Sep 2024 15:25:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA=E8=8E=B7=E5=8F=96=E6=8A=A5?= =?UTF-8?q?=E5=91=8AID=E9=9B=86=E5=90=88=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/definition/ApiReportController.java | 8 ++++++++ .../controller/scenario/ApiScenarioReportController.java | 8 ++++++++ .../api/controller/ApiReportControllerTests.java | 5 ++++- .../api/controller/ApiScenarioReportControllerTests.java | 5 ++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiReportController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiReportController.java index 85363e2696..ff217e1114 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiReportController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiReportController.java @@ -78,6 +78,14 @@ public class ApiReportController { apiReportService.batchDelete(request, SessionUtils.getUserId()); } + @PostMapping("/batch-param") + @Operation(summary = "接口测试-接口报告-获取用例报告批量参数") + @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") + @RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_READ) + public List batchParam(@Validated @RequestBody ApiReportBatchRequest request) { + return apiReportService.doSelectIds(request); + } + @GetMapping("/get/{id}") @Operation(summary = "接口测试-接口报告-报告获取") @CheckOwner(resourceId = "#id", resourceType = "api_report") diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioReportController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioReportController.java index d71d6b1c9a..f59232dd2b 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioReportController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/scenario/ApiScenarioReportController.java @@ -78,6 +78,14 @@ public class ApiScenarioReportController { apiScenarioReportService.batchDelete(request, SessionUtils.getUserId()); } + @PostMapping("/batch-param") + @Operation(summary = "接口测试-接口报告-获取场景报告批量参数") + @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") + @RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_READ) + public List batchParam(@Validated @RequestBody ApiReportBatchRequest request) { + return apiScenarioReportService.doSelectIds(request); + } + @GetMapping("/get/{id}") @Operation(summary = "接口测试-接口报告-报告获取") @CheckOwner(resourceId = "#id", resourceType = "api_scenario_report") diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiReportControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiReportControllerTests.java index e9fd8ec3a2..3ef762bcea 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiReportControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiReportControllerTests.java @@ -79,6 +79,7 @@ public class ApiReportControllerTests extends BaseTest { private static final String DELETE = BASIC + "/delete/"; private static final String GET = BASIC + "/get/"; private static final String BATCH_DELETE = BASIC + "/batch/delete"; + private static final String BATCH_PARAM = BASIC + "/batch-param"; private static final String DETAIL = BASIC + "/get/detail/"; private static final String EXPORT_REPORT = BASIC + "/export/{0}"; private static final String BATCH_EXPORT_REPORT = BASIC + "/batch-export"; @@ -189,7 +190,8 @@ public class ApiReportControllerTests extends BaseTest { requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_READ, PAGE, request); } - protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception { + @Override + protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception { return mockMvc.perform(getRequestBuilder(url, uriVariables)) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); @@ -242,6 +244,7 @@ public class ApiReportControllerTests extends BaseTest { Assertions.assertTrue(apiReport.getDeleted()); request.setSelectAll(true); responsePost(BATCH_DELETE, request); + responsePost(BATCH_PARAM, request); // @@校验权限 requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_DELETE, BATCH_DELETE, request); } diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java index 0c0b658820..d04727cfd2 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java @@ -86,6 +86,7 @@ public class ApiScenarioReportControllerTests extends BaseTest { private static final String DELETE = BASIC + "/delete/"; private static final String GET = BASIC + "/get/"; private static final String BATCH_DELETE = BASIC + "/batch/delete"; + private static final String BATCH_PARAM = BASIC + "/batch-param"; private static final String DETAIL = BASIC + "/get/detail/"; private static final String EXPORT_REPORT = BASIC + "/export/{0}"; private static final String BATCH_EXPORT_REPORT = BASIC + "/batch-export"; @@ -189,7 +190,8 @@ public class ApiScenarioReportControllerTests extends BaseTest { requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_READ, PAGE, request); } - protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception { + @Override + protected ResultActions requestGetWithOk(String url, Object... uriVariables) throws Exception { return mockMvc.perform(getRequestBuilder(url, uriVariables)) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); @@ -242,6 +244,7 @@ public class ApiScenarioReportControllerTests extends BaseTest { Assertions.assertTrue(apiReport.getDeleted()); request.setSelectAll(true); responsePost(BATCH_DELETE, request); + responsePost(BATCH_PARAM, request); // @@校验权限 requestPostPermissionTest(PermissionConstants.PROJECT_API_REPORT_DELETE, BATCH_DELETE, request); }