fix(接口测试): 版本创建问题

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-08 18:47:06 +08:00 committed by f2c-ci-robot[bot]
parent 6b63f338fa
commit 736657536f
5 changed files with 5 additions and 5 deletions

View File

@ -1334,6 +1334,7 @@ public class ApiAutomationService {
if (StringUtils.equals("fullCoverage", apiTestImportRequest.getModeId())) {
_importCreate(sameList, batchMapper, extApiScenarioMapper, scenarioWithBLOBs, apiTestImportRequest, apiTestCaseMapper, apiDefinitionMapper);
} else if (StringUtils.equals("incrementalMerge", apiTestImportRequest.getModeId())) {
scenarioWithBLOBs.setId(UUID.randomUUID().toString());
if (CollectionUtils.isEmpty(sameList)) {
if (scenarioWithBLOBs.getVersionId() != null && scenarioWithBLOBs.getVersionId().equals("new")) {
scenarioWithBLOBs.setLatest(apiTestImportRequest.getVersionId().equals(apiTestImportRequest.getDefaultVersion()));
@ -1342,7 +1343,6 @@ public class ApiAutomationService {
scenarioWithBLOBs.setRefId(scenarioWithBLOBs.getId());
scenarioWithBLOBs.setLatest(true);
}
scenarioWithBLOBs.setId(UUID.randomUUID().toString());
if (StringUtils.isNotEmpty(apiTestImportRequest.getVersionId())) {
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getVersionId());
} else {

View File

@ -804,6 +804,7 @@ public class ApiDefinitionService {
} else if (StringUtils.equals("incrementalMerge", apiTestImportRequest.getModeId())) {
if (CollectionUtils.isEmpty(collect)) {
String originId = apiDefinition.getId();
apiDefinition.setId(UUID.randomUUID().toString());
//postman 可能含有前置脚本接口定义去掉脚本
if (apiDefinition.getVersionId() != null && apiDefinition.getVersionId().equals("new")) {
apiDefinition.setLatest(apiTestImportRequest.getVersionId().equals(apiTestImportRequest.getDefaultVersion()));
@ -812,7 +813,6 @@ public class ApiDefinitionService {
apiDefinition.setRefId(apiDefinition.getId());
apiDefinition.setLatest(true); // 新增的接口 latest = true
}
apiDefinition.setId(UUID.randomUUID().toString());
if (StringUtils.isNotEmpty(apiTestImportRequest.getVersionId())) {
apiDefinition.setVersionId(apiTestImportRequest.getVersionId());
} else {
@ -820,7 +820,6 @@ public class ApiDefinitionService {
}
batchMapper.insert(apiDefinition);
String requestStr = setImportHashTree(apiDefinition);
// case 设置版本
cases.forEach(c -> {
c.setVersionId(apiDefinition.getVersionId());

View File

@ -749,7 +749,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
List<String> nameList = optionData.stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList());
//获取系统内重复数据
repeatApiDefinitionWithBLOBs = extApiDefinitionMapper.selectRepeatByProtocol(nameList, protocol);
repeatApiDefinitionWithBLOBs = extApiDefinitionMapper.selectRepeatByProtocol(nameList, protocol, projectId);
Map<String, ApiDefinitionWithBLOBs> repeatDataMap = null;

View File

@ -97,7 +97,7 @@ public interface ExtApiDefinitionMapper {
List<ApiDefinitionWithBLOBs> selectRepeatByBLOBsSameUrl(@Param("blobs") List<ApiDefinitionWithBLOBs> blobs, @Param("projectId") String projectId, @Param("moduleId") String moduleId);
List<ApiDefinitionWithBLOBs> selectRepeatByProtocol(@Param("names") List<String> names, @Param("protocol") String protocol);
List<ApiDefinitionWithBLOBs> selectRepeatByProtocol(@Param("names") List<String> names, @Param("protocol") String protocol, @Param("projectId") String projectId);
int countById(String id);
}

View File

@ -1102,6 +1102,7 @@
#{name}
</foreach>
and protocol = #{protocol}
and project_id = #{projectId}
and status != 'Trash'
</select>
<sql id="Same_Where_Clause">