fix(测试跟踪): 功能、接口用例添加依赖关系全选失效
--bug=1013801 --user=陈建星 【测试跟踪】功能用例-依赖关系-添加 部分问题处理 https://www.tapd.cn/55049933/s/1178280
This commit is contained in:
parent
d7e5cf0495
commit
a4097f9f02
|
@ -17,7 +17,6 @@ import io.metersphere.api.service.ApiDefinitionService;
|
||||||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||||
import io.metersphere.api.service.EsbApiParamService;
|
import io.metersphere.api.service.EsbApiParamService;
|
||||||
import io.metersphere.api.service.EsbImportService;
|
import io.metersphere.api.service.EsbImportService;
|
||||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
|
||||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||||
import io.metersphere.base.domain.Schedule;
|
import io.metersphere.base.domain.Schedule;
|
||||||
import io.metersphere.commons.constants.NoticeConstants;
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
|
@ -333,6 +332,11 @@ public class ApiDefinitionController {
|
||||||
return apiDefinitionService.getRelationshipRelateList(request, goPage, pageSize);
|
return apiDefinitionService.getRelationshipRelateList(request, goPage, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/relationship/add")
|
||||||
|
public void saveRelationshipBatch(@RequestBody ApiDefinitionRelationshipEdgeRequest request) {
|
||||||
|
apiDefinitionService.saveRelationshipBatch(request);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/follow/{definitionId}")
|
@GetMapping("/follow/{definitionId}")
|
||||||
public List<String> getFollows(@PathVariable String definitionId) {
|
public List<String> getFollows(@PathVariable String definitionId) {
|
||||||
return apiDefinitionService.getFollows(definitionId);
|
return apiDefinitionService.getFollows(definitionId);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
|
import io.metersphere.controller.request.RelationshipEdgeRequest;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ApiDefinitionRelationshipEdgeRequest extends RelationshipEdgeRequest {
|
||||||
|
private List<String> ids;
|
||||||
|
private ApiDefinitionRequest condition;
|
||||||
|
}
|
|
@ -2172,4 +2172,21 @@ public class ApiDefinitionService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveRelationshipBatch(ApiDefinitionRelationshipEdgeRequest request) {
|
||||||
|
List<String> relationshipIds = relationshipEdgeService.getRelationshipIds(request.getId());
|
||||||
|
request.getCondition().setNotInIds(relationshipIds);
|
||||||
|
request.getCondition().setId(null);
|
||||||
|
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||||
|
(query) -> extApiDefinitionMapper.selectIds(query));
|
||||||
|
List<String> ids = request.getIds();
|
||||||
|
ids.remove(request.getId());
|
||||||
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getTargetIds())) {
|
||||||
|
request.setTargetIds(ids);
|
||||||
|
} else if (CollectionUtils.isNotEmpty(request.getSourceIds())) {
|
||||||
|
request.setSourceIds(ids);
|
||||||
|
}
|
||||||
|
relationshipEdgeService.saveBatch(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,6 +539,12 @@
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.notInIds != null and request.notInIds.size() > 0">
|
||||||
|
and test_case.id not in
|
||||||
|
<foreach collection="request.notInIds" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="request.relevanceCreateTime >0">
|
<if test="request.relevanceCreateTime >0">
|
||||||
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >=
|
and test_case.id in (select test_case_id from test_case_test where test_case_test.create_time >=
|
||||||
#{request.createTime})
|
#{request.createTime})
|
||||||
|
|
|
@ -122,6 +122,11 @@ public class TestCaseController {
|
||||||
return testCaseService.getRelationshipCase(id, relationshipType);
|
return testCaseService.getRelationshipCase(id, relationshipType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/relationship/add")
|
||||||
|
public void saveRelationshipBatch(@RequestBody TestCaseRelationshipEdgeRequest request) {
|
||||||
|
testCaseService.saveRelationshipBatch(request);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/relationship/case/count/{id}")
|
@GetMapping("/relationship/case/count/{id}")
|
||||||
public int getRelationshipCase(@PathVariable("id") String id) {
|
public int getRelationshipCase(@PathVariable("id") String id) {
|
||||||
return testCaseService.getRelationshipCount(id);
|
return testCaseService.getRelationshipCount(id);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.metersphere.track.request.testcase;
|
||||||
|
|
||||||
|
import io.metersphere.controller.request.RelationshipEdgeRequest;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class TestCaseRelationshipEdgeRequest extends RelationshipEdgeRequest {
|
||||||
|
private List<String> ids;
|
||||||
|
private QueryTestCaseRequest condition;
|
||||||
|
}
|
|
@ -2741,4 +2741,20 @@ public class TestCaseService {
|
||||||
return testCaseNodeService.getNodeByTestCases(testCaseDTOS);
|
return testCaseNodeService.getNodeByTestCases(testCaseDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveRelationshipBatch(TestCaseRelationshipEdgeRequest request) {
|
||||||
|
List<String> relationshipIds = relationshipEdgeService.getRelationshipIds(request.getId());
|
||||||
|
request.getCondition().setNotInIds(relationshipIds);
|
||||||
|
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||||
|
(query) -> extTestCaseMapper.selectIds(query));
|
||||||
|
List<String> ids = request.getIds();
|
||||||
|
ids.remove(request.getId());
|
||||||
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getTargetIds())) {
|
||||||
|
request.setTargetIds(ids);
|
||||||
|
} else if (CollectionUtils.isNotEmpty(request.getSourceIds())) {
|
||||||
|
request.setSourceIds(ids);
|
||||||
|
}
|
||||||
|
relationshipEdgeService.saveBatch(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
|
this.condition = {};
|
||||||
this.$refs.baseRelevance.open();
|
this.$refs.baseRelevance.open();
|
||||||
this.initTable();
|
this.initTable();
|
||||||
if (this.$refs.nodeTree) {
|
if (this.$refs.nodeTree) {
|
||||||
|
@ -138,8 +139,9 @@
|
||||||
}
|
}
|
||||||
param.id = this.apiDefinitionId;
|
param.id = this.apiDefinitionId;
|
||||||
param.type = 'API';
|
param.type = 'API';
|
||||||
|
param.condition = this.condition;
|
||||||
|
|
||||||
this.result = this.$post('/relationship/edge/save/batch', param, () => {
|
this.result = this.$post('/api/definition/relationship/add', param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.$refs.baseRelevance.close();
|
this.$refs.baseRelevance.close();
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
|
|
|
@ -57,8 +57,9 @@ export default {
|
||||||
}
|
}
|
||||||
param.id = this.caseId;
|
param.id = this.caseId;
|
||||||
param.type = 'TEST_CASE';
|
param.type = 'TEST_CASE';
|
||||||
|
param.condition = this.page.condition;
|
||||||
|
|
||||||
vueObj.result = this.$post('/relationship/edge/save/batch', param, () => {
|
vueObj.result = this.$post('/test/case/relationship/add', param, () => {
|
||||||
vueObj.isSaving = false;
|
vueObj.isSaving = false;
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
vueObj.$refs.baseRelevance.close();
|
vueObj.$refs.baseRelevance.close();
|
||||||
|
|
|
@ -116,6 +116,7 @@ export default {
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
this.getProject();
|
this.getProject();
|
||||||
|
this.selectCounts = null;
|
||||||
this.$refs.relevanceDialog.open();
|
this.$refs.relevanceDialog.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
|
this.page.condition = {};
|
||||||
this.isSaving = false;
|
this.isSaving = false;
|
||||||
this.$refs.baseRelevance.open();
|
this.$refs.baseRelevance.open();
|
||||||
if (this.$refs.table) {
|
if (this.$refs.table) {
|
||||||
|
|
Loading…
Reference in New Issue