feat(接口定义): 接口定义和接口case高级搜索中提供已被场景引用的筛选条件#1002505
--story=1002505 --user=宋天阳 【github#5376】[FEATURE]接口定义和接口case,提供已被引用的筛选条件 https://www.tapd.cn/55049933/s/1037089
This commit is contained in:
parent
769d4bc204
commit
92c7b2c31d
|
@ -14,6 +14,7 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs {
|
|||
private List<String> ids;
|
||||
private List<OrderRequest> orders;
|
||||
private String projectId;
|
||||
private Map<String, Object> combine;
|
||||
|
||||
/**
|
||||
* isSelectAllDate:选择的数据是否是全部数据(全部数据是不受分页影响的数据)
|
||||
|
|
|
@ -522,7 +522,7 @@ public class ApiTestCaseService {
|
|||
public void deleteBatchByParam(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null);
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null,request.getCombine());
|
||||
}
|
||||
this.deleteBatch(ids);
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ public class ApiTestCaseService {
|
|||
public void editApiBathByParam(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null);
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null,request.getCombine());
|
||||
}
|
||||
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
|
||||
apiDefinitionExample.createCriteria().andIdIn(ids);
|
||||
|
@ -595,7 +595,7 @@ public class ApiTestCaseService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> getAllApiCaseIdsByFontedSelect(Map<String, List<String>> filters, List<String> moduleIds, String name, String projectId, String protocol, List<String> unSelectIds, String status, String apiId) {
|
||||
private List<String> getAllApiCaseIdsByFontedSelect(Map<String, List<String>> filters, List<String> moduleIds, String name, String projectId, String protocol, List<String> unSelectIds, String status, String apiId,Map<String, Object> combine) {
|
||||
ApiTestCaseRequest selectRequest = new ApiTestCaseRequest();
|
||||
selectRequest.setFilters(filters);
|
||||
selectRequest.setModuleIds(moduleIds);
|
||||
|
@ -605,6 +605,9 @@ public class ApiTestCaseService {
|
|||
selectRequest.setStatus(status);
|
||||
selectRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
selectRequest.setApiDefinitionId(apiId);
|
||||
if(combine != null){
|
||||
selectRequest.setCombine(combine);
|
||||
}
|
||||
List<ApiTestCaseDTO> list = extApiTestCaseMapper.listSimple(selectRequest);
|
||||
List<String> allIds = list.stream().map(ApiTestCaseDTO::getId).collect(Collectors.toList());
|
||||
List<String> ids = allIds.stream().filter(id -> !unSelectIds.contains(id)).collect(Collectors.toList());
|
||||
|
@ -856,7 +859,7 @@ public class ApiTestCaseService {
|
|||
public void deleteToGcByParam(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId());
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId(),request.getCombine());
|
||||
}
|
||||
this.deleteToGc(ids);
|
||||
}
|
||||
|
@ -864,7 +867,7 @@ public class ApiTestCaseService {
|
|||
public List<String> reduction(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null);
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null,request.getCombine());
|
||||
}
|
||||
|
||||
List<String> cannotReductionAPiName = new ArrayList<>();
|
||||
|
@ -898,7 +901,7 @@ public class ApiTestCaseService {
|
|||
public DeleteCheckResult checkDeleteDatas(ApiTestBatchRequest request) {
|
||||
List<String> deleteIds = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
deleteIds = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId());
|
||||
deleteIds = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId(),request.getCombine());
|
||||
}
|
||||
DeleteCheckResult result = new DeleteCheckResult();
|
||||
List<String> checkMsgList = new ArrayList<>();
|
||||
|
|
|
@ -131,6 +131,15 @@
|
|||
<property name="object" value="${condition}.status"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="${condition}.isReference != null">
|
||||
and api_definition.id
|
||||
<if test='${condition}.isReference.value == "true"'>
|
||||
in (SELECT reference_id FROM api_scenario_reference_id WHERE reference_id is not null )
|
||||
</if>
|
||||
<if test='${condition}.isReference.value == "false"'>
|
||||
not in (SELECT reference_id FROM api_scenario_reference_id WHERE reference_id is not null )
|
||||
</if>
|
||||
</if>
|
||||
<if test="${condition}.creator != null">
|
||||
and api_definition.user_id
|
||||
<include refid="condition">
|
||||
|
|
|
@ -187,7 +187,15 @@
|
|||
<property name="object" value="${condition}.tags"/>
|
||||
</include>
|
||||
</if>
|
||||
|
||||
<if test="${condition}.isReference != null">
|
||||
and t1.id
|
||||
<if test='${condition}.isReference.value == "true"'>
|
||||
in (SELECT reference_id FROM api_scenario_reference_id WHERE reference_id is not null )
|
||||
</if>
|
||||
<if test='${condition}.isReference.value == "false"'>
|
||||
not in (SELECT reference_id FROM api_scenario_reference_id WHERE reference_id is not null )
|
||||
</if>
|
||||
</if>
|
||||
<if test="${condition}.status != null">
|
||||
and t2.status
|
||||
<include refid="condition">
|
||||
|
|
|
@ -1237,4 +1237,15 @@ public class TestPlanReportService {
|
|||
|
||||
return report;
|
||||
}
|
||||
|
||||
public void deleteByPlanId(String planId) {
|
||||
TestPlanReportExample example = new TestPlanReportExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(planId);
|
||||
List<TestPlanReport> reportList = this.testPlanReportMapper.selectByExample(example);
|
||||
List<String> testPlanReportIdList = new ArrayList<>();
|
||||
for (TestPlanReport report:reportList) {
|
||||
testPlanReportIdList.add(report.getId());
|
||||
}
|
||||
this.delete(testPlanReportIdList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,6 +285,7 @@ public class TestPlanService {
|
|||
testPlanApiCaseService.deleteByPlanId(planId);
|
||||
testPlanScenarioCaseService.deleteByPlanId(planId);
|
||||
testPlanLoadCaseService.deleteByPlanId(planId);
|
||||
testPlanReportService.deleteByPlanId(planId);
|
||||
|
||||
//删除定时任务
|
||||
scheduleService.deleteByResourceId(planId, ScheduleGroup.TEST_PLAN_TEST.name());
|
||||
|
|
|
@ -290,6 +290,23 @@ export const EXECUTOR = {
|
|||
}
|
||||
}
|
||||
|
||||
export const ISREFERENCE = {
|
||||
key: "isReference",
|
||||
name: 'MsTableSearchSelect',
|
||||
label: 'api_test.scenario.reference',
|
||||
operator: {
|
||||
options: [OPERATORS.IN]
|
||||
},
|
||||
options: [
|
||||
{value: '', label: 'commons.default'},
|
||||
{value: 'true', label: 'commons.yes'},
|
||||
{value: 'false', label: 'commons.no'}
|
||||
],
|
||||
props: { // 尾部控件的props,一般为element ui控件的props
|
||||
multiple: false
|
||||
}
|
||||
}
|
||||
|
||||
export const TRIGGER_MODE = {
|
||||
key: "triggerMode",
|
||||
name: 'MsTableSearchSelect',
|
||||
|
@ -473,9 +490,9 @@ export const TEST_CASE_CONFIGS = [NAME, API_TAGS, MODULE, PRIORITY, CREATE_TIME,
|
|||
|
||||
export const TEST_PLAN_CONFIGS = [NAME, UPDATE_TIME, CREATE_TIME, PRINCIPAL, TEST_PLAN_STATUS, STAGE];
|
||||
|
||||
export const API_DEFINITION_CONFIGS = [NAME, API_METHOD, API_PATH, API_STATUS, API_TAGS, UPDATE_TIME, CREATE_TIME, CREATOR];
|
||||
export const API_DEFINITION_CONFIGS = [NAME, API_METHOD, API_PATH, API_STATUS, API_TAGS, UPDATE_TIME, CREATE_TIME, CREATOR,ISREFERENCE];
|
||||
|
||||
export const API_CASE_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, API_CASE_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR];
|
||||
export const API_CASE_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, API_CASE_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR,ISREFERENCE];
|
||||
|
||||
export const API_SCENARIO_CONFIGS = [NAME, API_CASE_PRIORITY, API_TAGS, API_SCENARIO_RESULT, UPDATE_TIME, CREATE_TIME, CREATOR];
|
||||
|
||||
|
|
Loading…
Reference in New Issue