diff --git a/backend/src/main/java/io/metersphere/api/controller/APIReportController.java b/backend/src/main/java/io/metersphere/api/controller/APIReportController.java index caa7374ebf..baccd9d85a 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APIReportController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APIReportController.java @@ -31,6 +31,7 @@ public class APIReportController { String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); QueryAPIReportRequest request = new QueryAPIReportRequest(); request.setWorkspaceId(currentWorkspaceId); + request.setUserId(SessionUtils.getUserId()); PageHelper.startPage(1, count, true); return apiReportService.recentTest(request); } diff --git a/backend/src/main/java/io/metersphere/api/controller/APITestController.java b/backend/src/main/java/io/metersphere/api/controller/APITestController.java index ad3940ac7a..b154da3e38 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APITestController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APITestController.java @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; + import java.util.List; @RestController @@ -33,6 +34,7 @@ public class APITestController { String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); QueryAPITestRequest request = new QueryAPITestRequest(); request.setWorkspaceId(currentWorkspaceId); + request.setUserId(SessionUtils.getUserId()); PageHelper.startPage(1, count, true); return apiTestService.recentTest(request); } diff --git a/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java b/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java index b5c3e69d15..231f061f53 100644 --- a/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java @@ -15,6 +15,7 @@ public class QueryAPIReportRequest { private String projectId; private String name; private String workspaceId; + private String userId; private boolean recent = false; private List orders; private Map> filters; diff --git a/backend/src/main/java/io/metersphere/api/dto/QueryAPITestRequest.java b/backend/src/main/java/io/metersphere/api/dto/QueryAPITestRequest.java index 74ea9ff567..43b9b5e38c 100644 --- a/backend/src/main/java/io/metersphere/api/dto/QueryAPITestRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/QueryAPITestRequest.java @@ -16,6 +16,7 @@ public class QueryAPITestRequest { private String projectId; private String name; private String workspaceId; + private String userId; private boolean recent = false; private List orders; private Map> filters; diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestMapper.xml index f8fb47b969..9ef36e84b7 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestMapper.xml @@ -120,6 +120,9 @@ AND api_test.id = #{request.id} + + AND api_test.user_id = #{request.userId} + diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml index 13d49c2f48..d7c92408b0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml @@ -85,6 +85,9 @@ and r.name like CONCAT('%', #{request.name},'%') + + AND r.user_id = #{request.userId,jdbcType=VARCHAR} + AND project.id = #{request.projectId} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml index 5320835edd..a8d6cd5c65 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestMapper.xml @@ -67,6 +67,9 @@ and load_test.name like CONCAT('%', #{request.name},'%') + + and load_test.user_id= #{request.userId} + AND project.workspace_id = #{request.workspaceId} 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 5ad1c807ab..24da5a2b22 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 @@ -84,6 +84,9 @@ AND ltr.name like CONCAT('%', #{reportRequest.name},'%') + + AND ltr.user_id = #{reportRequest.userId,jdbcType=VARCHAR} + AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java index e54e40675f..e1852d8bf5 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java @@ -35,6 +35,7 @@ public class PerformanceReportController { String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); ReportRequest request = new ReportRequest(); request.setWorkspaceId(currentWorkspaceId); + request.setUserId(SessionUtils.getUserId()); // 最近 `count` 个项目 PageHelper.startPage(1, count); return reportService.getRecentReportList(request); diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index fbc5086d11..9b7f94c4bf 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -41,6 +41,7 @@ public class PerformanceTestController { String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); QueryTestPlanRequest request = new QueryTestPlanRequest(); request.setWorkspaceId(currentWorkspaceId); + request.setUserId(SessionUtils.getUserId()); PageHelper.startPage(1, count, true); return performanceTestService.recentTestPlans(request); } 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 5a9c8c4be2..b1f47e9166 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 @@ -12,6 +12,7 @@ import java.util.Map; public class ReportRequest { private String name; private String workspaceId; + private String userId; private List orders; private Map> filters; private Map combine; diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index fac2c1cb7c..30ee8e8d4b 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -58,6 +58,7 @@ public class TestCaseController { String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); QueryTestCaseRequest request = new QueryTestCaseRequest(); request.setWorkspaceId(currentWorkspaceId); + request.setUserId(SessionUtils.getUserId()); return testCaseService.recentTestPlans(request, count); } diff --git a/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java b/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java index e47fb3aa16..c24ece68ea 100644 --- a/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java @@ -26,6 +26,8 @@ public class QueryTestCaseRequest extends TestCase { private String workspaceId; + private String userId; + private Map combine; private String reviewId; diff --git a/backend/src/main/java/io/metersphere/track/request/testplan/QueryTestPlanRequest.java b/backend/src/main/java/io/metersphere/track/request/testplan/QueryTestPlanRequest.java index 4a4446e97e..b7121c8f25 100644 --- a/backend/src/main/java/io/metersphere/track/request/testplan/QueryTestPlanRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testplan/QueryTestPlanRequest.java @@ -11,6 +11,7 @@ import java.util.Map; @Setter public class QueryTestPlanRequest extends TestPlanRequest { private String workspaceId; + private String userId; private List orders; private Map> filters; private Map combine; diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index ddb81b8678..7bf79cb658 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -248,7 +248,7 @@ public class TestCaseService { PageHelper.startPage(1, count, true); TestCaseExample testCaseExample = new TestCaseExample(); - testCaseExample.createCriteria().andProjectIdIn(projectIds); + testCaseExample.createCriteria().andProjectIdIn(projectIds).andMaintainerEqualTo(request.getUserId()); testCaseExample.setOrderByClause("update_time desc, sort desc"); return testCaseMapper.selectByExample(testCaseExample); } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index b7cb0e89e0..e237cb6ae3 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; + import java.util.*; import java.util.stream.Collectors; @@ -119,7 +120,7 @@ public class TestPlanService { if (TestPlanStatus.Underway.name().equals(testPlan.getStatus())) { testPlan.setActualStartTime(System.currentTimeMillis()); - } else if(TestPlanStatus.Completed.name().equals(testPlan.getStatus())){ + } else if (TestPlanStatus.Completed.name().equals(testPlan.getStatus())) { //已完成,写入实际完成时间 testPlan.setActualEndTime(System.currentTimeMillis()); } @@ -248,7 +249,8 @@ public class TestPlanService { return null; } TestPlanExample testPlanTestCaseExample = new TestPlanExample(); - testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId); + testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId) + .andPrincipalEqualTo(SessionUtils.getUserId()); testPlanTestCaseExample.setOrderByClause("update_time desc"); return testPlanMapper.selectByExample(testPlanTestCaseExample); } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 9bc20f26bc..8f7700d869 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -306,7 +306,7 @@ export default { api_test_report: 'Api Test Report', load_test_report: 'Load Test Report', test_plan_report: 'Test Plan Report', - recent: 'Recent Report', + recent: 'My recent Report', search_by_name: 'Search by Name', test_name: 'Test', test_overview: 'Test Overview', @@ -344,7 +344,7 @@ export default { run: 'One click operation', operating: 'Operating', pressure_prediction_chart: 'Pressure Prediction Chart', - recent: 'Recent Tests', + recent: 'My recent Tests', search_by_name: 'Search by name', project_name: 'Project', delete_confirm: 'Are you sure want to delete test: ', @@ -650,8 +650,8 @@ export default { save: "Save", return: "Return", length_less_than: "The length less than", - recent_plan: "Recent plan", - recent_case: "Recent case", + recent_plan: "My recent plan", + recent_case: "My recent case", recent_review: "Recent review", pass_rate: "Pass rate", execution_result: ": Please select the execution result", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index d1b1ddc921..3c68b12412 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -306,7 +306,7 @@ export default { api_test_report: '接口测试报告', load_test_report: '性能测试报告', test_plan_report: '测试计划报告', - recent: '最近的报告', + recent: '我最近的报告', search_by_name: '根据名称搜索', test_name: '所属测试', test_overview: '测试概览', @@ -343,7 +343,7 @@ export default { same_project_test: '只能运行同一项目内的测试', already_exists: '测试名称不能重复', operating: '操作', - recent: '最近的测试', + recent: '我最近的测试', search_by_name: '根据名称搜索', project_name: '所属项目', delete_confirm: '确认删除测试: ', @@ -652,8 +652,8 @@ export default { save: "保 存", return: "返 回", length_less_than: "长度必须小于", - recent_plan: "最近的计划", - recent_case: "最近的用例", + recent_plan: "我最近的计划", + recent_case: "我最近的用例", recent_review: "最近的评审", pass_rate: "通过率", execution_result: ": 请选择执行结果", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index ab5d7c6c4f..b3e78e8578 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -306,7 +306,7 @@ export default { api_test_report: '接口測試報告', load_test_report: '性能測試報告', test_plan_report: '測試計劃報告', - recent: '最近的報告', + recent: '我最近的報告', search_by_name: '根據名稱搜索', test_name: '所屬測試', test_overview: '測試概覽', @@ -343,7 +343,7 @@ export default { same_project_test: '只能運行同壹項目內的測試', already_exists: '測試名稱不能重復', operating: '操作', - recent: '最近的測試', + recent: '我最近的測試', search_by_name: '根據名稱搜索', project_name: '所屬項目', delete_confirm: '確認刪除測試: ', @@ -652,8 +652,8 @@ export default { save: "保 存", return: "返 回", length_less_than: "長度必須小於", - recent_plan: "最近的計劃", - recent_case: "最近的用例", + recent_plan: "我最近的計劃", + recent_case: "我最近的用例", recent_review: "最近的評審", pass_rate: "通過率", execution_result: ": 請選擇執行結果",