fix(接口测试): 修复用例批量筛选不生效的缺陷

--bug=1037724 --user=王孝刚 【接口测试】接口定义-CASE列表-搜索后批量编辑CASE用例等级/状态/追加标签失败
https://www.tapd.cn/55049933/s/1502719
This commit is contained in:
wxg0103 2024-04-19 19:21:06 +08:00 committed by Craftsman
parent 6eb05354b3
commit 5cdcd4029a
5 changed files with 40 additions and 17 deletions

View File

@ -373,6 +373,7 @@
and ( and (
atc.name like concat('%', #{request.condition.keyword},'%') atc.name like concat('%', #{request.condition.keyword},'%')
or atc.num like concat('%', #{request.condition.keyword},'%') or atc.num like concat('%', #{request.condition.keyword},'%')
or a.path like concat('%', #{request.condition.keyword},'%')
or atc.tags like concat('%', #{request.condition.keyword},'%') or atc.tags like concat('%', #{request.condition.keyword},'%')
) )
</if> </if>

View File

@ -156,16 +156,18 @@ public class ApiDefinitionImportUtilService {
//如果导入的时候选择了模块需要把所有的导入数据的模块路径前面拼接上选择的模块路径 //如果导入的时候选择了模块需要把所有的导入数据的模块路径前面拼接上选择的模块路径
if (StringUtils.isNotBlank(request.getModuleId())) { if (StringUtils.isNotBlank(request.getModuleId())) {
BaseTreeNode baseTreeNode = idModuleMap.get(request.getModuleId()); BaseTreeNode baseTreeNode = idModuleMap.get(request.getModuleId());
String modulePath = baseTreeNode.getPath(); if (baseTreeNode != null) {
//如果选择了未规划模块 导入的数据的模块清空 只导入数据不处理模块信息 String modulePath = baseTreeNode.getPath();
if ("root".equals(request.getModuleId())) { //如果选择了未规划模块 导入的数据的模块清空 只导入数据不处理模块信息
importData.forEach(t -> { if ("root".equals(request.getModuleId())) {
t.setModulePath(modulePath); importData.forEach(t -> {
}); t.setModulePath(modulePath);
} else { });
importData.forEach(t -> { } else {
t.setModulePath(modulePath + t.getModulePath()); importData.forEach(t -> {
}); t.setModulePath(modulePath + t.getModulePath());
});
}
} }
} }
//去掉apiLists中不存在的模块数据 //去掉apiLists中不存在的模块数据

View File

@ -413,6 +413,7 @@ public class ApiTestCaseService extends MoveNodeService {
public List<String> doSelectIds(ApiTestCaseBatchRequest request, boolean deleted) { public List<String> doSelectIds(ApiTestCaseBatchRequest request, boolean deleted) {
if (request.isSelectAll()) { if (request.isSelectAll()) {
List<String> ids = extApiTestCaseMapper.getIds(request, deleted); List<String> ids = extApiTestCaseMapper.getIds(request, deleted);
ids.addAll(request.getSelectIds());
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
ids.removeAll(request.getExcludeIds()); ids.removeAll(request.getExcludeIds());
} }

View File

@ -2566,19 +2566,38 @@ public class ApiScenarioService extends MoveNodeService {
} }
response.addSuccessData(copyScenario.getId(), copyScenario.getNum(), copyScenario.getName()); response.addSuccessData(copyScenario.getId(), copyScenario.getNum(), copyScenario.getName());
} }
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
response.setSuccess(apiScenarioMapper.batchInsert(insertApiScenarioList)); ApiScenarioMapper mapper = sqlSession.getMapper(ApiScenarioMapper.class);
SubListUtils.dealForSubList(insertApiScenarioList, 100, subList -> {
subList.forEach(mapper::insertSelective);
});
response.setSuccess(insertApiScenarioList.size());
if (CollectionUtils.isNotEmpty(insertApiScenarioBlobList)) { if (CollectionUtils.isNotEmpty(insertApiScenarioBlobList)) {
apiScenarioBlobMapper.batchInsert(insertApiScenarioBlobList); ApiScenarioBlobMapper blobMapper = sqlSession.getMapper(ApiScenarioBlobMapper.class);
SubListUtils.dealForSubList(insertApiScenarioBlobList, 100, subList -> {
subList.forEach(blobMapper::insertSelective);
});
} }
if (CollectionUtils.isNotEmpty(insertApiScenarioStepList)) { if (CollectionUtils.isNotEmpty(insertApiScenarioStepList)) {
apiScenarioStepMapper.batchInsert(insertApiScenarioStepList); ApiScenarioStepMapper stepMapper = sqlSession.getMapper(ApiScenarioStepMapper.class);
SubListUtils.dealForSubList(insertApiScenarioStepList, 100, subList -> {
subList.forEach(stepMapper::insertSelective);
});
} }
if (CollectionUtils.isNotEmpty(insertApiScenarioStepBlobList)) { if (CollectionUtils.isNotEmpty(insertApiScenarioStepBlobList)) {
apiScenarioStepBlobMapper.batchInsert(insertApiScenarioStepBlobList); ApiScenarioStepBlobMapper stepBlobMapper = sqlSession.getMapper(ApiScenarioStepBlobMapper.class);
SubListUtils.dealForSubList(insertApiScenarioStepBlobList, 100, subList -> {
subList.forEach(stepBlobMapper::insertSelective);
});
} }
if (CollectionUtils.isNotEmpty(insertApiFileResourceList)) { if (CollectionUtils.isNotEmpty(insertApiFileResourceList)) {
apiFileResourceService.batchInsert(insertApiFileResourceList); SubListUtils.dealForSubList(insertApiFileResourceList, 100, subList -> {
apiFileResourceService.batchInsert(subList);
});
}
sqlSession.flushStatements();
if (sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
} }
return response; return response;
} }

View File

@ -415,7 +415,7 @@
() => visible.value, () => visible.value,
(val) => { (val) => {
if (val) { if (val) {
importForm.value.moduleId = props.activeModule !== 'all' ? props.activeModule : 'root'; importForm.value.moduleId = props.activeModule !== 'all' ? props.activeModule : '';
} }
}, },
{ {