fix(测试计划): 修复接口用例重复关联case问题

--bug=1044413 --user=王旭 【测试计划】测试规划-接口用例-选中模块后再取消勾选一个接口关联数据错误 https://www.tapd.cn/55049933/s/1553561
This commit is contained in:
WangXu10 2024-07-24 13:55:32 +08:00 committed by 刘瑞斌
parent 63d9b09831
commit 6373a4a5f7
3 changed files with 7 additions and 2 deletions

View File

@ -108,5 +108,5 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCase> getListBySelectIds(@Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("testPlanId") String testPlanId, @Param("protocols") List<String> protocols);
List<ApiTestCase> getCaseListBySelectIds(@Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("testPlanId") String testPlanId, @Param("protocols") List<String> protocols);
List<ApiTestCase> getCaseListBySelectIds(@Param("isRepeat") boolean isRepeat, @Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("testPlanId") String testPlanId, @Param("protocols") List<String> protocols);
}

View File

@ -712,6 +712,11 @@
#{protocol}
</foreach>
</if>
<if test="!isRepeat">
AND api_test_case.id not in (
select api_case_id from test_plan_api_case where test_plan_id = #{testPlanId}
)
</if>
</select>

View File

@ -644,7 +644,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
if (CollectionUtils.isNotEmpty(dto.getSelectIds())) {
CollectionUtils.removeAll(dto.getSelectIds(), apiTestCaseList.stream().map(ApiTestCase::getId).toList());
//获取选中的ids数据
List<ApiTestCase> selectIdList = extApiTestCaseMapper.getCaseListBySelectIds(apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols());
List<ApiTestCase> selectIdList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols());
apiTestCaseList.addAll(selectIdList);
}