fix(接口测试): 场景导入设置默认版本

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-05 11:43:24 +08:00 committed by xiaomeinvG
parent 0190739cd6
commit bf431e8c3c
4 changed files with 7 additions and 37 deletions

View File

@ -1376,7 +1376,6 @@ public class ApiAutomationService {
}
for (int i = 0; i < data.size(); i++) {
ApiScenarioWithBLOBs item = data.get(i);
List<ApiScenarioWithBLOBs> sameList = needUpdateList.stream().filter(t -> t.getId().equals(item.getId())).collect(toList());
if (StringUtils.isBlank(item.getCreateUser())) {

View File

@ -528,9 +528,9 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
//处理模块
setModule(optionData, moduleMap, pidChildrenMap, idPathMap, idModuleMap, chooseModule);
List<String> names = optionData.stream().map(ApiScenario::getName).collect(Collectors.toList());
//系统内重复的数据
List<ApiScenarioWithBLOBs> repeatApiScenarioWithBLOBs = extApiScenarioMapper.selectRepeatByBLOBs(optionData, projectId, versionSet);
List<ApiScenarioWithBLOBs> repeatApiScenarioWithBLOBs = extApiScenarioMapper.selectRepeatByBLOBs(names, projectId, versionSet);
moduleMap = getApiScenarioModuleMap(fullCoverage, fullCoverageScenario, moduleMap, toUpdateList, chooseModuleId, idPathMap, chooseModule, optionData, repeatApiScenarioWithBLOBs);

View File

@ -91,9 +91,7 @@ public interface ExtApiScenarioMapper {
List<ApiScenarioWithBLOBs> selectByStatusIsNotTrash();
List<ApiScenarioWithBLOBs> selectRepeatByBLOBs(@Param("blobs") List<ApiScenarioWithBLOBs> blobs, @Param("projectId") String projectId, @Param("versionIds") Set<String> versionIds);
List<ApiScenarioWithBLOBs> selectRepeatByBLOBsSameUrl(@Param("blobs") List<ApiScenarioWithBLOBs> blobs, @Param("projectId") String projectId, @Param("moduleId") String moduleId, @Param("versionIds") Set<String> versionIds);
List<ApiScenarioWithBLOBs> selectRepeatByBLOBs(@Param("names") List<String> names, @Param("projectId") String projectId, @Param("versionIds") Set<String> versionIds);
}

View File

@ -822,7 +822,10 @@
</select>
<select id="selectRepeatByBLOBs" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
SELECT * from api_scenario
<include refid="Same_Where_Clause"/>
where name in
<foreach collection="names" item="name" separator="," open="(" close=")">
#{name}
</foreach>
and status != 'Trash'
and project_id = #{projectId}
and version_id in
@ -831,35 +834,5 @@
</foreach>
</select>
<select id="selectRepeatByBLOBsSameUrl" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
SELECT * from api_scenario
<include refid="Same_Where_Clause"/>
and status != 'TRASH'
and api_scenario_module_id = #{moduleId}
and project_id = #{projectId}
and version_id in
<foreach collection="versionIds" item="versionId" separator="," open="(" close=")">
#{versionId}
</foreach>
</select>
<sql id="Same_Where_Clause">
<where>
<if test="blobs">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="blobs" item="blob" separator="or">
<trim prefix="(" prefixOverrides="and" suffix=")">
<if test="blob.name">
and api_scenario.name = #{blob.name}
</if>
</trim>
</foreach>
</trim>
</if>
</where>
</sql>
</mapper>