From 61e88258f097c863822d1defa5a43e6dcd960d62 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 24 Apr 2020 10:19:23 +0800 Subject: [PATCH] recent report --- .../base/mapper/ext/ExtLoadTestReportMapper.xml | 6 ++++++ .../controller/PerformanceReportController.java | 4 +++- .../main/java/io/metersphere/service/ReportService.java | 9 ++------- 3 files changed, 11 insertions(+), 8 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 2f4e443055..cb8e89e0e5 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 @@ -19,10 +19,16 @@ select ltr.id, ltr.name, ltr.test_id as testId, ltr.description, ltr.create_time as createTime, ltr.update_time as updateTime, ltr.status as status, lt.name as testName from load_test_report ltr join load_test lt on ltr.test_id = lt.id + + JOIN project on project.id = lt.project_id + AND ltr.name like CONCAT('%', #{reportRequest.name},'%') + + AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR} + ORDER BY ltr.update_time DESC diff --git a/backend/src/main/java/io/metersphere/controller/PerformanceReportController.java b/backend/src/main/java/io/metersphere/controller/PerformanceReportController.java index 662ffab951..3f03a49108 100644 --- a/backend/src/main/java/io/metersphere/controller/PerformanceReportController.java +++ b/backend/src/main/java/io/metersphere/controller/PerformanceReportController.java @@ -27,7 +27,7 @@ public class PerformanceReportController { @GetMapping("/recent/{count}") @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) - public List recentProjects(@PathVariable int count) { + public List recentProjects(@PathVariable int count) { String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); ReportRequest request = new ReportRequest(); request.setWorkspaceId(currentWorkspaceId); @@ -38,6 +38,8 @@ public class PerformanceReportController { @PostMapping("/list/all/{goPage}/{pageSize}") public Pager> getReportList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ReportRequest request) { + String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); + request.setWorkspaceId(currentWorkspaceId); Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, reportService.getReportList(request)); } diff --git a/backend/src/main/java/io/metersphere/service/ReportService.java b/backend/src/main/java/io/metersphere/service/ReportService.java index aab6c1b19c..40ef1ae63b 100644 --- a/backend/src/main/java/io/metersphere/service/ReportService.java +++ b/backend/src/main/java/io/metersphere/service/ReportService.java @@ -35,13 +35,8 @@ public class ReportService { @Resource private LoadTestReportResultMapper loadTestReportResultMapper; - public List getRecentReportList(ReportRequest request) { - LoadTestReportExample example = new LoadTestReportExample(); - LoadTestReportExample.Criteria criteria = example.createCriteria(); - // - - example.setOrderByClause("update_time desc"); - return loadTestReportMapper.selectByExample(example); + public List getRecentReportList(ReportRequest request) { + return extLoadTestReportMapper.getReportList(request); } public List getReportList(ReportRequest request) {