fix(测试跟踪): 首页缺陷统计中用例数统计错误

--bug=1010392 --user=陈建星 【测试跟踪】-首页遗留缺陷统计的测试计划用例数错误,是所有测试计划的用例,不是该测试计划中用例数 https://www.tapd.cn/55049933/s/1106885
This commit is contained in:
chenjianxing 2022-02-21 17:48:36 +08:00 committed by 刘瑞斌
parent 19939e86ec
commit 2f98c9c2d3
3 changed files with 11 additions and 3 deletions

View File

@ -19,4 +19,6 @@ public class IssuesDao extends IssuesWithBLOBs {
private List<String> tapdUsers;
private List<String>zentaoBuilds;
private String zentaoAssigned;
private String refType;
private String refId;
}

View File

@ -12,7 +12,7 @@
</select>
<select id="getIssueForMinder" resultType="io.metersphere.base.domain.IssuesDao">
select issues.id, issues.title , issues.num , test_case_issues.resource_id as caseId
select issues.id, issues.title , issues.num , test_case_issues.resource_id, test_case_issues.ref_id, test_case_issues.ref_type
from issues
inner join test_case_issues
on test_case_issues.issues_id = issues.id

View File

@ -1925,12 +1925,18 @@ public class TestCaseService {
if (CollectionUtils.isNotEmpty(caseIds)) {
List<IssuesDao> issues = extIssuesMapper.getIssueForMinder(caseIds, refType);
for (IssuesDao item : issues) {
List<IssuesDao> list = issueMap.get(item.getCaseId());
String key;
if (item.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name())) {
key = item.getRefId();
} else {
key = item.getResourceId();
}
List<IssuesDao> list = issueMap.get(key);
if (list == null) {
list = new ArrayList<>();
}
list.add(item);
issueMap.put(item.getCaseId(), list);
issueMap.put(key, list);
}
}
return issueMap;