From 38cf12fbcbe684c09cd2b5562bd6a3f590193905 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 10 Dec 2020 18:29:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8C=89=E7=85=A7=E9=A1=B9=E7=9B=AE=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/ext/ExtLoadTestReportMapper.xml | 7 ++++--- .../controller/request/ReportRequest.java | 1 + .../service/PerformanceTestService.java | 8 +++++++- .../performance/service/ReportService.java | 3 +++ backend/src/main/java/io/metersphere/xpack | 2 +- .../components/common/head/SearchList.vue | 19 ------------------- frontend/src/business/components/xpack | 2 +- 7 files changed, 17 insertions(+), 25 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml index 24da5a2b22..d89c770d7c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml @@ -71,9 +71,7 @@ from load_test_report ltr join load_test lt on ltr.test_id = lt.id join user on ltr.user_id = user.id - - JOIN project on project.id = lt.project_id - + join project on project.id = lt.project_id @@ -90,6 +88,9 @@ AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR} + + AND project.id = #{reportRequest.projectId,jdbcType=VARCHAR} + diff --git a/backend/src/main/java/io/metersphere/performance/controller/request/ReportRequest.java b/backend/src/main/java/io/metersphere/performance/controller/request/ReportRequest.java index b1f47e9166..fa6b697f59 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/request/ReportRequest.java +++ b/backend/src/main/java/io/metersphere/performance/controller/request/ReportRequest.java @@ -16,4 +16,5 @@ public class ReportRequest { private List orders; private Map> filters; private Map combine; + private String projectId; } diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index add70f7054..dcf8c57919 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -79,6 +79,7 @@ public class PerformanceTestService { public List list(QueryTestPlanRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extLoadTestMapper.list(request); } @@ -320,6 +321,7 @@ public class PerformanceTestService { orderRequest.setType("desc"); orders.add(orderRequest); request.setOrders(orders); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extLoadTestMapper.list(request); } @@ -462,7 +464,11 @@ public class PerformanceTestService { .collect(Collectors.toList()); if (!resourceIds.isEmpty()) { LoadTestExample example = new LoadTestExample(); - example.createCriteria().andIdIn(resourceIds); + LoadTestExample.Criteria criteria = example.createCriteria(); + if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) { + criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId()); + } + criteria.andIdIn(resourceIds); List loadTests = loadTestMapper.selectByExample(example); Map loadTestMap = loadTests.stream().collect(Collectors.toMap(LoadTest::getId, LoadTest::getName)); scheduleService.build(loadTestMap, schedules); diff --git a/backend/src/main/java/io/metersphere/performance/service/ReportService.java b/backend/src/main/java/io/metersphere/performance/service/ReportService.java index 1e6cc8b353..016852399b 100644 --- a/backend/src/main/java/io/metersphere/performance/service/ReportService.java +++ b/backend/src/main/java/io/metersphere/performance/service/ReportService.java @@ -10,6 +10,7 @@ import io.metersphere.commons.constants.ReportKeys; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.ServiceUtils; +import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.OrderRequest; import io.metersphere.dto.LogDetailDTO; import io.metersphere.dto.ReportDTO; @@ -59,11 +60,13 @@ public class ReportService { orderRequest.setType("desc"); orders.add(orderRequest); request.setOrders(orders); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extLoadTestReportMapper.getReportList(request); } public List getReportList(ReportRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setProjectId(SessionUtils.getCurrentProjectId()); return extLoadTestReportMapper.getReportList(request); } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index bb494fc68a..905ca8af61 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6 +Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e diff --git a/frontend/src/business/components/common/head/SearchList.vue b/frontend/src/business/components/common/head/SearchList.vue index b3f47d280f..5bf6e2fa18 100644 --- a/frontend/src/business/components/common/head/SearchList.vue +++ b/frontend/src/business/components/common/head/SearchList.vue @@ -32,12 +32,8 @@ export default { options: Object }, mounted() { - console.log('mounted') this.init(); }, - beforeDestroy() { - console.log('beforeDestroy') - }, data() { return { result: {}, @@ -55,21 +51,6 @@ export default { } } }, - computed: { - // getIndex: function () { - // return function (item) { - // return this.options.index(item); - // } - // }, - // getRouter: function () { - // return function (item) { - // if (this.options.router) { - // return this.options.router(item); - // } - // } - // } - }, - methods: { init: function () { if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) { diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index a22a3005d9..29a8fc0960 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a +Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836