fix(测试跟踪): 测试计划勾选允许重复后,关联功能用例选择全部用例关联失效

--bug=1021865 --user=陈建星 【测试跟踪】测试计划-开启允许关联重复用例后-重复关联所有数据失败 https://www.tapd.cn/55049933/s/1326152
This commit is contained in:
chenjianxing 2023-01-11 15:22:58 +08:00 committed by jianxing
parent 59c415948a
commit cfa09d83df
3 changed files with 17 additions and 2 deletions

View File

@ -155,6 +155,8 @@ public interface ExtTestCaseMapper {
List<TestCase> getMaintainerMap(@Param("request") QueryTestCaseRequest request);
List<TestCase> getMaintainerMapForPlanRepeat(@Param("request") QueryTestCaseRequest request);
List<TestCaseDTO> getForNodeEdit(@Param("ids") List<String> ids);
List<CustomFieldResourceCompatibleDTO> getForCompatibleCustomField(String projectId, int offset, int pageSize);

View File

@ -1216,6 +1216,14 @@
and T2.case_id is null
order by test_case.`order` desc, test_case.sort desc
</select>
<select id="getMaintainerMapForPlanRepeat" resultType="io.metersphere.base.domain.TestCase">
select test_case.id as id, test_case.maintainer as maintainer
from test_case as test_case
<include refid="notInQueryWhereCondition"/>
order by test_case.`order` desc, test_case.sort desc
</select>
<select id="getForNodeEdit" resultType="io.metersphere.dto.TestCaseDTO">
select test_case.id, test_case.node_id, test_case.node_path
from test_case where node_id in

View File

@ -53,6 +53,7 @@ import io.metersphere.xpack.api.service.ApiPoolDebugService;
import io.metersphere.xpack.track.dto.IssuesDao;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
@ -546,10 +547,14 @@ public class TestPlanService {
public void testPlanRelevance(PlanCaseRelevanceRequest request) {
LinkedHashMap<String, String> userMap;
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
boolean isSelectAll = request.getRequest() != null && request.getRequest().isSelectAll();
if (isSelectAll) {
List<TestCase> maintainerMap = extTestCaseMapper.getMaintainerMap(request.getRequest());
List<TestCase> maintainerMap;
if (BooleanUtils.isTrue(testPlan.getRepeatCase())) {
maintainerMap = extTestCaseMapper.getMaintainerMapForPlanRepeat(request.getRequest());
} else {
maintainerMap = extTestCaseMapper.getMaintainerMap(request.getRequest());
}
userMap = maintainerMap.stream()
.collect(LinkedHashMap::new, (m, v) -> m.put(v.getId(), v.getMaintainer()), LinkedHashMap::putAll);
} else {