parent
138f2ccfe6
commit
cb7051ff9a
|
@ -1307,6 +1307,8 @@ public class ApiAutomationService {
|
|||
|
||||
List<ApiScenarioWithBLOBs> initData = apiImport.getData();
|
||||
currentScenarioOrder.remove();
|
||||
String defaultVersion = extProjectVersionMapper.getDefaultVersion(request.getProjectId());
|
||||
request.setDefaultVersion(defaultVersion);
|
||||
|
||||
UpdateScenarioModuleDTO updateScenarioModuleDTO = apiScenarioModuleService.checkScenarioModule(request, initData, StringUtils.equals("fullCoverage", request.getModeId()), request.getCoverModule());
|
||||
List<ApiScenarioModule> moduleList = updateScenarioModuleDTO.getModuleList();
|
||||
|
@ -1326,10 +1328,8 @@ public class ApiAutomationService {
|
|||
num = getNextNum(data.get(0).getProjectId());
|
||||
request.setOpenCustomNum(config.getScenarioCustomNum());
|
||||
}
|
||||
String defaultVersion = extProjectVersionMapper.getDefaultVersion(request.getProjectId());
|
||||
request.setDefaultVersion(defaultVersion);
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
|
||||
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())) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -756,7 +756,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
|
||||
|
@ -765,35 +768,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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue