refactor: 缺陷列表点击关联用例跳转到用例列表过滤

This commit is contained in:
chenjianxing 2021-07-09 14:52:49 +08:00 committed by jianxing
parent df1c5b2962
commit b865b9d3b6
5 changed files with 21 additions and 3 deletions

View File

@ -3,6 +3,8 @@ package io.metersphere.base.domain;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class IssuesDao extends IssuesWithBLOBs {
@ -11,4 +13,5 @@ public class IssuesDao extends IssuesWithBLOBs {
private String creatorName;
private String resourceName;
private long caseCount;
private List<String> caseIds;
}

View File

@ -334,6 +334,12 @@
or test_case.tags like CONCAT('%', #{request.name},'%')
or test_case.custom_num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.ids != null">
and test_case.id in
<foreach collection="request.ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</if>
<if test="request.relevanceCreateTime >0">
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >=
#{request.createTime})

View File

@ -363,8 +363,12 @@ public class IssuesService {
}
TestCaseIssuesExample example = new TestCaseIssuesExample();
example.createCriteria().andIssuesIdEqualTo(item.getId());
long caseCount = testCaseIssuesMapper.countByExample(example);
item.setCaseCount(caseCount);
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
List<String> caseIds = testCaseIssues.stream()
.map(TestCaseIssues::getTestCaseId)
.collect(Collectors.toList());
item.setCaseIds(caseIds);
item.setCaseCount(testCaseIssues.size());
});
return issues;
}

View File

@ -339,7 +339,12 @@ export default {
activated() {
this.getTemplateField();
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]};
let ids = this.$route.params.ids;
if (ids) {
this.condition.ids = ids;
}
this.initTableData();
this.condition.ids = null;
},
watch: {
selectNodeIds() {

View File

@ -120,7 +120,7 @@
:label="item.label"
prop="caseCount">
<template v-slot="scope">
<router-link :to="'/track/case/all'">
<router-link :to="scope.row.caseCount > 0 ? {name: 'testCase', params: { projectId: 'all', ids: scope.row.caseIds }} : {}">
{{scope.row.caseCount}}
</router-link>
</template>