refactor(测试跟踪): 优化测试跟踪首页查询

This commit is contained in:
shiziyuan9527 2020-11-03 14:33:20 +08:00
parent b2560a8496
commit ce0a688130
6 changed files with 42 additions and 10 deletions

View File

@ -31,4 +31,11 @@ public interface ExtTestPlanTestCaseMapper {
List<String> getTestPlanTestCaseIds(String testId);
/**
* 根据项目 ids 查询 TestPlanCaseDTO 列表
* @param ids project id list
* @return List<TestPlanCaseDTO>
*/
List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
}

View File

@ -210,6 +210,14 @@
</foreach>
</if>
</select>
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select distinct * from test_plan_test_case, test_case
where test_plan_test_case.case_id = test_case.id
and test_case.project_id in
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="listByNode" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.*, test_case.*
from test_plan_test_case

View File

@ -12,4 +12,11 @@ public interface ExtTestReviewCaseMapper {
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
List<String> getStatusByReviewId(String reviewId);
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
/**
* 根据项目 ids 查询 TestReviewCaseDTO 列表
* @param ids project id list
* @return List<TestReviewCaseDTO>
*/
List<TestReviewCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
}

View File

@ -195,4 +195,12 @@
where test_case_review_test_case.review_id = #{userId}
and project.workspace_id = #{workspaceId}
</select>
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select distinct * from test_case_review_test_case, test_case
where test_case_review_test_case.case_id = test_case.id
and test_case.project_id in
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper>

View File

@ -484,7 +484,7 @@ public class TestCaseReviewService {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentOrganizationId());
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId());
List<TestReviewDTOWithMetric> testReviews = extTestCaseReviewMapper.listRelate(request);
@ -553,10 +553,11 @@ public class TestCaseReviewService {
return name;
}
public List<TestReviewCaseDTO> listTestCaseByProjectIds(List<String> projectIds) {
QueryCaseReviewRequest request = new QueryCaseReviewRequest();
request.setProjectIds(projectIds);
return extTestReviewCaseMapper.list(request);
private List<TestReviewCaseDTO> listTestCaseByProjectIds(List<String> projectIds) {
if (CollectionUtils.isEmpty(projectIds)) {
return new ArrayList<>();
}
return extTestReviewCaseMapper.listTestCaseByProjectIds(projectIds);
}
/*编辑,新建,完成,删除通知内容*/

View File

@ -365,7 +365,7 @@ public class TestPlanService {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentOrganizationId());
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId());
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.listRelate(request);
@ -411,10 +411,11 @@ public class TestPlanService {
return testPlanTestCaseService.list(request);
}
public List<TestPlanCaseDTO> listTestCaseByProjectIds(List<String> projectIds) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setProjectIds(projectIds);
return extTestPlanTestCaseMapper.list(request);
private List<TestPlanCaseDTO> listTestCaseByProjectIds(List<String> projectIds) {
if (CollectionUtils.isEmpty(projectIds)) {
return new ArrayList<>();
}
return extTestPlanTestCaseMapper.listTestCaseByProjectIds(projectIds);
}
public TestCaseReportMetricDTO getMetric(String planId) {