feat: 最近的测试,用例,计划改为我最近的测试,用例,计划。

This commit is contained in:
q4speed 2020-10-10 11:13:46 +08:00
parent af046d0f91
commit 6ca14fe393
19 changed files with 41 additions and 15 deletions

View File

@ -31,6 +31,7 @@ public class APIReportController {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
QueryAPIReportRequest request = new QueryAPIReportRequest(); QueryAPIReportRequest request = new QueryAPIReportRequest();
request.setWorkspaceId(currentWorkspaceId); request.setWorkspaceId(currentWorkspaceId);
request.setUserId(SessionUtils.getUserId());
PageHelper.startPage(1, count, true); PageHelper.startPage(1, count, true);
return apiReportService.recentTest(request); return apiReportService.recentTest(request);
} }

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@RestController @RestController
@ -33,6 +34,7 @@ public class APITestController {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
QueryAPITestRequest request = new QueryAPITestRequest(); QueryAPITestRequest request = new QueryAPITestRequest();
request.setWorkspaceId(currentWorkspaceId); request.setWorkspaceId(currentWorkspaceId);
request.setUserId(SessionUtils.getUserId());
PageHelper.startPage(1, count, true); PageHelper.startPage(1, count, true);
return apiTestService.recentTest(request); return apiTestService.recentTest(request);
} }

View File

@ -15,6 +15,7 @@ public class QueryAPIReportRequest {
private String projectId; private String projectId;
private String name; private String name;
private String workspaceId; private String workspaceId;
private String userId;
private boolean recent = false; private boolean recent = false;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;

View File

@ -16,6 +16,7 @@ public class QueryAPITestRequest {
private String projectId; private String projectId;
private String name; private String name;
private String workspaceId; private String workspaceId;
private String userId;
private boolean recent = false; private boolean recent = false;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;

View File

@ -120,6 +120,9 @@
<if test="request.id != null"> <if test="request.id != null">
AND api_test.id = #{request.id} AND api_test.id = #{request.id}
</if> </if>
<if test="request.userId != null">
AND api_test.user_id = #{request.userId}
</if>
<if test="request.filters != null and request.filters.size() > 0"> <if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values"> <foreach collection="request.filters.entrySet()" index="key" item="values">

View File

@ -85,6 +85,9 @@
<if test="request.name != null"> <if test="request.name != null">
and r.name like CONCAT('%', #{request.name},'%') and r.name like CONCAT('%', #{request.name},'%')
</if> </if>
<if test="request.userId != null">
AND r.user_id = #{request.userId,jdbcType=VARCHAR}
</if>
<if test="request.projectId != null"> <if test="request.projectId != null">
AND project.id = #{request.projectId} AND project.id = #{request.projectId}
</if> </if>

View File

@ -67,6 +67,9 @@
<if test="request.name != null"> <if test="request.name != null">
and load_test.name like CONCAT('%', #{request.name},'%') and load_test.name like CONCAT('%', #{request.name},'%')
</if> </if>
<if test="request.userId != null">
and load_test.user_id= #{request.userId}
</if>
<if test="request.workspaceId != null"> <if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId} AND project.workspace_id = #{request.workspaceId}
</if> </if>

View File

@ -84,6 +84,9 @@
<if test="reportRequest.name != null"> <if test="reportRequest.name != null">
AND ltr.name like CONCAT('%', #{reportRequest.name},'%') AND ltr.name like CONCAT('%', #{reportRequest.name},'%')
</if> </if>
<if test="reportRequest.userId != null">
AND ltr.user_id = #{reportRequest.userId,jdbcType=VARCHAR}
</if>
<if test="reportRequest.workspaceId != null"> <if test="reportRequest.workspaceId != null">
AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR} AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR}
</if> </if>

View File

@ -35,6 +35,7 @@ public class PerformanceReportController {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
ReportRequest request = new ReportRequest(); ReportRequest request = new ReportRequest();
request.setWorkspaceId(currentWorkspaceId); request.setWorkspaceId(currentWorkspaceId);
request.setUserId(SessionUtils.getUserId());
// 最近 `count` 个项目 // 最近 `count` 个项目
PageHelper.startPage(1, count); PageHelper.startPage(1, count);
return reportService.getRecentReportList(request); return reportService.getRecentReportList(request);

View File

@ -41,6 +41,7 @@ public class PerformanceTestController {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
QueryTestPlanRequest request = new QueryTestPlanRequest(); QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setWorkspaceId(currentWorkspaceId); request.setWorkspaceId(currentWorkspaceId);
request.setUserId(SessionUtils.getUserId());
PageHelper.startPage(1, count, true); PageHelper.startPage(1, count, true);
return performanceTestService.recentTestPlans(request); return performanceTestService.recentTestPlans(request);
} }

View File

@ -12,6 +12,7 @@ import java.util.Map;
public class ReportRequest { public class ReportRequest {
private String name; private String name;
private String workspaceId; private String workspaceId;
private String userId;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;
private Map<String, Object> combine; private Map<String, Object> combine;

View File

@ -58,6 +58,7 @@ public class TestCaseController {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
QueryTestCaseRequest request = new QueryTestCaseRequest(); QueryTestCaseRequest request = new QueryTestCaseRequest();
request.setWorkspaceId(currentWorkspaceId); request.setWorkspaceId(currentWorkspaceId);
request.setUserId(SessionUtils.getUserId());
return testCaseService.recentTestPlans(request, count); return testCaseService.recentTestPlans(request, count);
} }

View File

@ -26,6 +26,8 @@ public class QueryTestCaseRequest extends TestCase {
private String workspaceId; private String workspaceId;
private String userId;
private Map<String, Object> combine; private Map<String, Object> combine;
private String reviewId; private String reviewId;

View File

@ -11,6 +11,7 @@ import java.util.Map;
@Setter @Setter
public class QueryTestPlanRequest extends TestPlanRequest { public class QueryTestPlanRequest extends TestPlanRequest {
private String workspaceId; private String workspaceId;
private String userId;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;
private Map<String, Object> combine; private Map<String, Object> combine;

View File

@ -248,7 +248,7 @@ public class TestCaseService {
PageHelper.startPage(1, count, true); PageHelper.startPage(1, count, true);
TestCaseExample testCaseExample = new TestCaseExample(); TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andProjectIdIn(projectIds); testCaseExample.createCriteria().andProjectIdIn(projectIds).andMaintainerEqualTo(request.getUserId());
testCaseExample.setOrderByClause("update_time desc, sort desc"); testCaseExample.setOrderByClause("update_time desc, sort desc");
return testCaseMapper.selectByExample(testCaseExample); return testCaseMapper.selectByExample(testCaseExample);
} }

View File

@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -119,7 +120,7 @@ public class TestPlanService {
if (TestPlanStatus.Underway.name().equals(testPlan.getStatus())) { if (TestPlanStatus.Underway.name().equals(testPlan.getStatus())) {
testPlan.setActualStartTime(System.currentTimeMillis()); testPlan.setActualStartTime(System.currentTimeMillis());
} else if(TestPlanStatus.Completed.name().equals(testPlan.getStatus())){ } else if (TestPlanStatus.Completed.name().equals(testPlan.getStatus())) {
//已完成写入实际完成时间 //已完成写入实际完成时间
testPlan.setActualEndTime(System.currentTimeMillis()); testPlan.setActualEndTime(System.currentTimeMillis());
} }
@ -248,7 +249,8 @@ public class TestPlanService {
return null; return null;
} }
TestPlanExample testPlanTestCaseExample = new TestPlanExample(); TestPlanExample testPlanTestCaseExample = new TestPlanExample();
testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId); testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId)
.andPrincipalEqualTo(SessionUtils.getUserId());
testPlanTestCaseExample.setOrderByClause("update_time desc"); testPlanTestCaseExample.setOrderByClause("update_time desc");
return testPlanMapper.selectByExample(testPlanTestCaseExample); return testPlanMapper.selectByExample(testPlanTestCaseExample);
} }

View File

@ -306,7 +306,7 @@ export default {
api_test_report: 'Api Test Report', api_test_report: 'Api Test Report',
load_test_report: 'Load Test Report', load_test_report: 'Load Test Report',
test_plan_report: 'Test Plan Report', test_plan_report: 'Test Plan Report',
recent: 'Recent Report', recent: 'My recent Report',
search_by_name: 'Search by Name', search_by_name: 'Search by Name',
test_name: 'Test', test_name: 'Test',
test_overview: 'Test Overview', test_overview: 'Test Overview',
@ -344,7 +344,7 @@ export default {
run: 'One click operation', run: 'One click operation',
operating: 'Operating', operating: 'Operating',
pressure_prediction_chart: 'Pressure Prediction Chart', pressure_prediction_chart: 'Pressure Prediction Chart',
recent: 'Recent Tests', recent: 'My recent Tests',
search_by_name: 'Search by name', search_by_name: 'Search by name',
project_name: 'Project', project_name: 'Project',
delete_confirm: 'Are you sure want to delete test: ', delete_confirm: 'Are you sure want to delete test: ',
@ -650,8 +650,8 @@ export default {
save: "Save", save: "Save",
return: "Return", return: "Return",
length_less_than: "The length less than", length_less_than: "The length less than",
recent_plan: "Recent plan", recent_plan: "My recent plan",
recent_case: "Recent case", recent_case: "My recent case",
recent_review: "Recent review", recent_review: "Recent review",
pass_rate: "Pass rate", pass_rate: "Pass rate",
execution_result: ": Please select the execution result", execution_result: ": Please select the execution result",

View File

@ -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: '最近的报告',
search_by_name: '根据名称搜索', search_by_name: '根据名称搜索',
test_name: '所属测试', test_name: '所属测试',
test_overview: '测试概览', test_overview: '测试概览',
@ -343,7 +343,7 @@ export default {
same_project_test: '只能运行同一项目内的测试', same_project_test: '只能运行同一项目内的测试',
already_exists: '测试名称不能重复', already_exists: '测试名称不能重复',
operating: '操作', operating: '操作',
recent: '最近的测试', recent: '最近的测试',
search_by_name: '根据名称搜索', search_by_name: '根据名称搜索',
project_name: '所属项目', project_name: '所属项目',
delete_confirm: '确认删除测试: ', delete_confirm: '确认删除测试: ',
@ -652,8 +652,8 @@ export default {
save: "保 存", save: "保 存",
return: "返 回", return: "返 回",
length_less_than: "长度必须小于", length_less_than: "长度必须小于",
recent_plan: "最近的计划", recent_plan: "最近的计划",
recent_case: "最近的用例", recent_case: "最近的用例",
recent_review: "最近的评审", recent_review: "最近的评审",
pass_rate: "通过率", pass_rate: "通过率",
execution_result: ": 请选择执行结果", execution_result: ": 请选择执行结果",

View File

@ -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: '最近的報告',
search_by_name: '根據名稱搜索', search_by_name: '根據名稱搜索',
test_name: '所屬測試', test_name: '所屬測試',
test_overview: '測試概覽', test_overview: '測試概覽',
@ -343,7 +343,7 @@ export default {
same_project_test: '只能運行同壹項目內的測試', same_project_test: '只能運行同壹項目內的測試',
already_exists: '測試名稱不能重復', already_exists: '測試名稱不能重復',
operating: '操作', operating: '操作',
recent: '最近的測試', recent: '最近的測試',
search_by_name: '根據名稱搜索', search_by_name: '根據名稱搜索',
project_name: '所屬項目', project_name: '所屬項目',
delete_confirm: '確認刪除測試: ', delete_confirm: '確認刪除測試: ',
@ -652,8 +652,8 @@ export default {
save: "保 存", save: "保 存",
return: "返 回", return: "返 回",
length_less_than: "長度必須小於", length_less_than: "長度必須小於",
recent_plan: "最近的計劃", recent_plan: "最近的計劃",
recent_case: "最近的用例", recent_case: "最近的用例",
recent_review: "最近的評審", recent_review: "最近的評審",
pass_rate: "通過率", pass_rate: "通過率",
execution_result: ": 請選擇執行結果", execution_result: ": 請選擇執行結果",