refactor(测试跟踪): 关联场景用例支持全选
This commit is contained in:
parent
c9b399172f
commit
c2ce23fcac
|
@ -1032,20 +1032,27 @@ public class ApiAutomationService {
|
|||
}
|
||||
|
||||
public void relevance(ApiCaseRelevanceRequest request) {
|
||||
buildApiCaseRelevanceRequest(request);
|
||||
|
||||
Map<String, List<String>> mapping = request.getMapping();
|
||||
Map<String, String> envMap = request.getEnvMap();
|
||||
Set<String> set = mapping.keySet();
|
||||
List<String> relevanceIds = request.getSelectIds();
|
||||
List<String> relevanceIds = request.getIds();
|
||||
Collections.reverse(relevanceIds);
|
||||
String envType = request.getEnvironmentType();
|
||||
String envGroupId = request.getEnvGroupId();
|
||||
if (set.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Long nextOrder = ServiceUtils.getNextOrder(request.getPlanId(), extTestPlanScenarioCaseMapper::getLastOrder);
|
||||
for (String id : relevanceIds) {
|
||||
Map<String, String> newEnvMap = new HashMap<>(16);
|
||||
List<String> list = mapping.get(id);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
ScenarioEnv scenarioEnv = getApiScenarioProjectId(id);
|
||||
list = new ArrayList<>(scenarioEnv.getProjectIds());
|
||||
}
|
||||
list.forEach(l -> newEnvMap.put(l, envMap == null ? "" : envMap.getOrDefault(l, "")));
|
||||
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||
testPlanApiScenario.setId(UUID.randomUUID().toString());
|
||||
|
@ -1070,6 +1077,12 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
|
||||
public void buildApiCaseRelevanceRequest(ApiCaseRelevanceRequest request) {
|
||||
this.initRequest(request.getCondition(), true, true);
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||
(query) -> extApiScenarioMapper.selectRelevanceIdsByQuery(query));
|
||||
}
|
||||
|
||||
public void relevanceReview(ApiCaseRelevanceRequest request) {
|
||||
Map<String, List<String>> mapping = request.getMapping();
|
||||
Map<String, String> envMap = request.getEnvMap();
|
||||
|
|
|
@ -94,4 +94,5 @@ public interface ExtApiScenarioMapper {
|
|||
List<ApiScenarioWithBLOBs> selectRepeatByBLOBs(@Param("names") List<String> names, @Param("projectId") String projectId);
|
||||
|
||||
|
||||
List<String> selectRelevanceIdsByQuery(@Param("request") BaseQueryRequest query);
|
||||
}
|
||||
|
|
|
@ -763,6 +763,11 @@
|
|||
and status != 'Trash'
|
||||
and project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
<select id="selectRelevanceIdsByQuery" resultType="java.lang.String">
|
||||
select api_scenario.id
|
||||
from api_scenario
|
||||
<include refid="queryWhereCondition"/>
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.track.request.testcase;
|
||||
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -27,6 +28,8 @@ public class ApiCaseRelevanceRequest {
|
|||
*/
|
||||
private List<String> selectIds = new ArrayList<>();
|
||||
|
||||
private List<String> ids = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 项目环境对应关系
|
||||
*/
|
||||
|
@ -43,4 +46,6 @@ public class ApiCaseRelevanceRequest {
|
|||
|
||||
private String environmentType;
|
||||
private String envGroupId;
|
||||
|
||||
private ApiScenarioRequest condition;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
@order="search"
|
||||
@filter="filterSearch"
|
||||
:disable-header-config="true"
|
||||
:show-select-all="false"
|
||||
:show-select-all="true"
|
||||
@selectCountChange="selectCountChange">
|
||||
|
||||
<el-table-column v-if="!customNum" prop="num" label="ID" sortable="custom"
|
||||
|
|
|
@ -75,9 +75,6 @@ export default {
|
|||
watch: {
|
||||
planId() {
|
||||
this.condition.planId = this.planId;
|
||||
},
|
||||
projectId() {
|
||||
this.getVersionOptions();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -164,7 +161,8 @@ export default {
|
|||
param.envMap = strMapToObj(envMap);
|
||||
param.environmentType = envType;
|
||||
param.envGroupId = envGroupId;
|
||||
param.selectIds = selectIds;
|
||||
param.ids = selectIds;
|
||||
param.condition = this.$refs.apiScenarioList.condition;
|
||||
|
||||
this.result = this.$post(url, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
|
|
Loading…
Reference in New Issue