fix(测试计划): 关联功能用例时的顺序问题
--bug=1010510 --user=李玉号 【测试计划】-关联功能用例后的顺序是倒序,建议按照功能用例显示的顺序关联 https://www.tapd.cn/55049933/s/1108617
This commit is contained in:
parent
5050fdcdfa
commit
cd62370a2f
|
@ -147,6 +147,5 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
int addLatestVersion(@Param("refId") String refId);
|
||||
|
||||
@MapKey("id")
|
||||
Map<String, TestCase> getMaintainerMap(@Param("request") QueryTestCaseRequest request);
|
||||
List<TestCase> getMaintainerMap(@Param("request") QueryTestCaseRequest request);
|
||||
}
|
||||
|
|
|
@ -1003,6 +1003,7 @@
|
|||
left join test_plan_test_case as T2 on test_case.id=T2.case_id and T2.plan_id =#{request.planId}
|
||||
<include refid="notInQueryWhereCondition"/>
|
||||
and T2.case_id is null
|
||||
order by test_case.`order` desc, test_case.sort desc
|
||||
</select>
|
||||
|
||||
<update id="addLatestVersion">
|
||||
|
|
|
@ -531,19 +531,18 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
public void testPlanRelevance(PlanCaseRelevanceRequest request) {
|
||||
Map<String, String> userMap = new HashMap<>();
|
||||
LinkedHashMap<String, String> userMap;
|
||||
boolean isSelectAll = request.getRequest() != null && request.getRequest().isSelectAll();
|
||||
if (isSelectAll) {
|
||||
Map<String, TestCase> maintainerMap = extTestCaseMapper.getMaintainerMap(request.getRequest());
|
||||
for (String k : maintainerMap.keySet()) {
|
||||
userMap.put(k, maintainerMap.get(k).getMaintainer());
|
||||
}
|
||||
List<TestCase> maintainerMap = extTestCaseMapper.getMaintainerMap(request.getRequest());
|
||||
userMap = maintainerMap.stream()
|
||||
.collect(LinkedHashMap::new, (m, v) -> m.put(v.getId(), v.getMaintainer()), LinkedHashMap::putAll);
|
||||
} else {
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
testCaseExample.createCriteria().andIdIn(request.getIds());
|
||||
List<TestCase> testCaseList = testCaseMapper.selectByExample(testCaseExample);
|
||||
userMap = testCaseList.stream()
|
||||
.collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getMaintainer()), HashMap::putAll);
|
||||
.collect(LinkedHashMap::new, (m, v) -> m.put(v.getId(), v.getMaintainer()), LinkedHashMap::putAll);
|
||||
}
|
||||
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
|
@ -555,6 +554,11 @@ public class TestPlanService {
|
|||
return;
|
||||
}
|
||||
|
||||
// 保持关联顺序
|
||||
if (!isSelectAll) {
|
||||
testCaseIds = request.getIds();
|
||||
}
|
||||
|
||||
// 尽量保持与用例顺序一致
|
||||
Collections.reverse(testCaseIds);
|
||||
|
||||
|
|
Loading…
Reference in New Issue