From b536fff9bfa0d697eb4dc036f378df592a1fc111 Mon Sep 17 00:00:00 2001 From: "song.tianyang" Date: Tue, 26 Jan 2021 23:54:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=85=A8=E9=80=89=E6=93=8D=E4=BD=9C=E8=B7=A8=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决接口定义全选操作跨协议的问题 --- .../definition/ApiDefinitionBatchProcessingRequest.java | 2 ++ .../io/metersphere/api/service/ApiDefinitionService.java | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchProcessingRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchProcessingRequest.java index 44a17ab1c6..44c3c2d774 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchProcessingRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchProcessingRequest.java @@ -37,4 +37,6 @@ public class ApiDefinitionBatchProcessingRequest { private List dataIds; + private String protocol; + } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index e03afa3ef7..6a7a8a4634 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -487,7 +487,7 @@ public class ApiDefinitionService { public void editApiByParam(ApiBatchRequest request) { List ids = request.getIds(); if (request.isSelectAllDate()) { - ids = this.getAllApiIdsByFontedSelect(request.getFilters(), request.getName(), request.getModuleIds(), request.getProjectId(), request.getUnSelectIds()); + ids = this.getAllApiIdsByFontedSelect(request.getFilters(), request.getName(), request.getModuleIds(), request.getProjectId(), request.getUnSelectIds(),request.getProtocol()); } //name在这里只是查询参数 request.setName(null); @@ -551,20 +551,21 @@ public class ApiDefinitionService { public void deleteByParams(ApiDefinitionBatchProcessingRequest request) { List apiIds = request.getDataIds(); if (request.isSelectAllDate()) { - apiIds = this.getAllApiIdsByFontedSelect(request.getFilters(), request.getName(), request.getModuleIds(), request.getProjectId(), request.getUnSelectIds()); + apiIds = this.getAllApiIdsByFontedSelect(request.getFilters(), request.getName(), request.getModuleIds(), request.getProjectId(), request.getUnSelectIds(),request.getProtocol()); } ApiDefinitionExample example = new ApiDefinitionExample(); example.createCriteria().andIdIn(apiIds); apiDefinitionMapper.deleteByExample(example); } - private List getAllApiIdsByFontedSelect(Map> filters, String name, List moduleIds, String projectId, List unSelectIds) { + private List getAllApiIdsByFontedSelect(Map> filters, String name, List moduleIds, String projectId, List unSelectIds,String protocol) { ApiDefinitionRequest request = new ApiDefinitionRequest(); request.setFilters(filters); request.setName(name); request.setModuleIds(moduleIds); request.setProjectId(projectId); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + request.setProtocol(protocol); List resList = extApiDefinitionMapper.list(request); List ids = new ArrayList<>(0); if (!resList.isEmpty()) { @@ -577,7 +578,7 @@ public class ApiDefinitionService { public void removeToGcByParams(ApiDefinitionBatchProcessingRequest request) { List apiIds = request.getDataIds(); if (request.isSelectAllDate()) { - apiIds = this.getAllApiIdsByFontedSelect(request.getFilters(), request.getName(), request.getModuleIds(), request.getProjectId(), request.getUnSelectIds()); + apiIds = this.getAllApiIdsByFontedSelect(request.getFilters(), request.getName(), request.getModuleIds(), request.getProjectId(), request.getUnSelectIds(),request.getProtocol()); } extApiDefinitionMapper.removeToGc(apiIds); }