fix(测试跟踪): 缺陷关联用例统计了回收站用例
--bug=1014485 --user=陈建星 【测试跟踪】缺陷管理页面用例数,删除后列表页和编辑页面没有同步删除 https://www.tapd.cn/55049933/s/1194698
This commit is contained in:
parent
902e32b9ee
commit
879dcfae1a
|
@ -859,6 +859,7 @@
|
||||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
and test_case.status != 'Trash'
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectRelateIdsByQuery" resultType="java.lang.String">
|
<select id="selectRelateIdsByQuery" resultType="java.lang.String">
|
||||||
|
|
|
@ -428,14 +428,26 @@ public class IssuesService {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
TestCaseIssuesExample example = new TestCaseIssuesExample();
|
TestCaseIssuesExample example = new TestCaseIssuesExample();
|
||||||
example.createCriteria().andIssuesIdIn(ids);
|
example.createCriteria()
|
||||||
|
.andIssuesIdIn(ids);
|
||||||
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
|
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
|
||||||
|
|
||||||
|
List<String> caseIds = testCaseIssues.stream().map(x ->
|
||||||
|
x.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name()) ? x.getRefId() : x.getResourceId())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<TestCaseDTO> notInTrashCase = testCaseService.getTestCaseByIds(caseIds);
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(notInTrashCase)) {
|
||||||
|
Set<String> notInTrashCaseSet = notInTrashCase.stream()
|
||||||
|
.map(TestCaseDTO::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
testCaseIssues.forEach(i -> {
|
testCaseIssues.forEach(i -> {
|
||||||
Set<String> caseIdSet = new HashSet<>();
|
Set<String> caseIdSet = new HashSet<>();
|
||||||
if (i.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name())) {
|
String caseId = i.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name()) ? i.getRefId() : i.getResourceId();
|
||||||
caseIdSet.add(i.getRefId());
|
if (notInTrashCaseSet.contains(caseId)) {
|
||||||
} else {
|
caseIdSet.add(caseId);
|
||||||
caseIdSet.add(i.getResourceId());
|
|
||||||
}
|
}
|
||||||
if (map.get(i.getIssuesId()) != null) {
|
if (map.get(i.getIssuesId()) != null) {
|
||||||
map.get(i.getIssuesId()).addAll(caseIdSet);
|
map.get(i.getIssuesId()).addAll(caseIdSet);
|
||||||
|
@ -443,6 +455,7 @@ public class IssuesService {
|
||||||
map.put(i.getIssuesId(), caseIdSet);
|
map.put(i.getIssuesId(), caseIdSet);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue