From 3f6ba6680c92e1665d72c965862074df56e6600f Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 27 Dec 2023 16:10:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdk/constants/PermissionConstants.java | 5 +- .../src/main/resources/i18n/api.properties | 1 + .../main/resources/i18n/api_en_US.properties | 1 + .../main/resources/i18n/api_zh_CN.properties | 1 + .../main/resources/i18n/api_zh_TW.properties | 1 + .../main/resources/i18n/commons.properties | 4 +- .../resources/i18n/commons_en_US.properties | 4 +- .../resources/i18n/commons_zh_CN.properties | 4 +- .../resources/i18n/commons_zh_TW.properties | 4 +- .../definition/ApiDefinitionController.java | 12 + .../importdto/ApiDeatlWithData.java | 22 + .../importdto/ApiDeatlWithDataUpdate.java | 21 + .../importdto/ApiDefinitionImport.java | 18 + .../importdto/ApiDefinitionImportDTO.java | 2 +- .../api/dto/request/ImportRequest.java | 30 +- .../api/dto/request/http/body/JsonBody.java | 7 +- .../api/dto/schema/JsonSchemaItem.java | 58 + .../api/enums/PropertyConstant.java | 33 + .../api/mapper/ExtApiDefinitionMapper.java | 2 +- .../api/mapper/ExtApiDefinitionMapper.xml | 6 +- .../api/parser/api/Swagger3Parser.java | 673 ++++++++- .../jmeter/body/MsJsonBodyConverter.java | 1 + .../ApiDefinitionImportUtilService.java | 647 +++++++++ .../definition/ApiDefinitionService.java | 126 +- .../ApiDefinitionControllerTests.java | 224 ++- .../api/controller/MsHTTPElementTest.java | 3 +- .../metersphere/api/parser/ParserTests.java | 6 - .../src/test/resources/file/openapi.json | 1225 +++++++++++++++++ .../src/test/resources/file/openapi1.json | 1225 +++++++++++++++++ .../src/test/resources/file/openapi2.json | 772 +++++++++++ .../src/test/resources/file/openapi3.json | 1 + .../system/service/BaseUserRoleService.java | 2 +- 32 files changed, 5026 insertions(+), 115 deletions(-) create mode 100644 backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithData.java create mode 100644 backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithDataUpdate.java create mode 100644 backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImport.java rename backend/services/api-test/src/main/java/io/metersphere/api/dto/{ => definition}/importdto/ApiDefinitionImportDTO.java (92%) create mode 100644 backend/services/api-test/src/main/java/io/metersphere/api/dto/schema/JsonSchemaItem.java create mode 100644 backend/services/api-test/src/main/java/io/metersphere/api/enums/PropertyConstant.java create mode 100644 backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java create mode 100644 backend/services/api-test/src/test/resources/file/openapi.json create mode 100644 backend/services/api-test/src/test/resources/file/openapi1.json create mode 100644 backend/services/api-test/src/test/resources/file/openapi2.json create mode 100644 backend/services/api-test/src/test/resources/file/openapi3.json diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java index bb7916c06d..06f5055381 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java @@ -206,7 +206,6 @@ public class PermissionConstants { /*------ end: PROJECT_TEMPLATE ------*/ - /*------ start: FUNCTIONAL_CASE ------*/ public static final String FUNCTIONAL_CASE_READ = "FUNCTIONAL_CASE:READ"; public static final String FUNCTIONAL_CASE_READ_ADD = "FUNCTIONAL_CASE:READ+ADD"; @@ -278,12 +277,10 @@ public class PermissionConstants { public static final String PROJECT_API_SCENARIO_DEBUG = "PROJECT_API_SCENARIO:READ+DEBUG"; - - /*------ end: API_MANAGEMENT ------*/ //个人中心 /*------ start: PERSONAL_CENTER ------*/ - public static final String SYSTEM_PERSONAL_API_KEY_ADD = "SYSTEM_PERSONAL_API_KEYD:READ+ADD"; + public static final String SYSTEM_PERSONAL_API_KEY_ADD = "SYSTEM_PERSONAL_API_KEY:READ+ADD"; public static final String SYSTEM_PERSONAL_API_KEY_DELETE = "SYSTEM_PERSONAL_API_KEY:READ+DELETE"; public static final String SYSTEM_PERSONAL_API_KEY_READ = "SYSTEM_PERSONAL_API_KEY:READ"; public static final String SYSTEM_PERSONAL_API_KEY_UPDATE = "SYSTEM_PERSONAL_API_KEY:READ+UPDATE"; diff --git a/backend/framework/sdk/src/main/resources/i18n/api.properties b/backend/framework/sdk/src/main/resources/i18n/api.properties index 9745d4aa6c..def7ac807c 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api.properties @@ -304,3 +304,4 @@ api_definition_exist=接口已存在 api_definition_mock_exist=接口 MOCK 已存在 execute_resource_pool_not_config_error=请在【项目管理-应用管理-接口测试】中选择资源池 resource_pool_execute_error=资源池调用失败 +api_swagger_url_error=Swagger url无法连通 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties index a002ef8821..5307166f1c 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties @@ -308,3 +308,4 @@ api_definition_exist=The API already exists api_definition_mock_exist=The API MOCK already exists execute_resource_pool_not_config_error=Select a resource pool in 【Project Management - Application Management - Interface Testing】 resource_pool_execute_error=The resource pool call failed +api_swagger_url_error=Swagger url unable to connect \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties index 2e5f1cce59..5a57f4dc75 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties @@ -308,3 +308,4 @@ api_definition_exist=接口已存在 api_definition_mock_exist=接口 MOCK 已存在 execute_resource_pool_not_config_error=请在【项目管理-应用管理-接口测试】中选择资源池 resource_pool_execute_error=资源池调用失败 +api_swagger_url_error=Swagger url无法连通 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties index 3760d3a70e..f16fa693ad 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties @@ -308,3 +308,4 @@ api_definition_exist=接口已存在 api_definition_mock_exist=接口 MOCK 已存在 execute_resource_pool_not_config_error=請在【項目管理-應用管理-接口測試】中選擇資源池 resource_pool_execute_error=資源池調用失敗 +api_swagger_url_error=Swagger url無法調解 diff --git a/backend/framework/sdk/src/main/resources/i18n/commons.properties b/backend/framework/sdk/src/main/resources/i18n/commons.properties index 307b223193..2fa6379381 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons.properties @@ -491,4 +491,6 @@ priority_is_null=用例等级不能为空 apikey_has_expired=ApiKey 已过期 user_key.id.not_blank=ApiKey ID不能为空 expire_time_not_null=过期时间不能为空 -permission.organization.name=组织 \ No newline at end of file +permission.organization.name=组织 +swagger_parse_error_with_auth=Swagger 解析失败,请确认认证信息是否正确或文件格式是否正确! +swagger_parse_error=Swagger 解析失败,请确认文件格式是否正确! \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties index a50314d9b4..7bc3f4fe51 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_en_US.properties @@ -501,4 +501,6 @@ priority_is_null=Priority is null apikey_has_expired=ApiKey has expired user_key.id.not_blank=User key id can not blank expire_time_not_null=Expire time can not null -permission.organization.name=Organization \ No newline at end of file +permission.organization.name=Organization +swagger_parse_error_with_auth=Swagger parsing failed, please confirm whether the verification information is correct or the file format is correct! +swagger_parse_error=Swagger parsing failed or file format is incorrect! \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties index 4488f98c88..c9c259dc27 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_zh_CN.properties @@ -497,4 +497,6 @@ priority_is_null=用例等级不能为空 apikey_has_expired=ApiKey 已过期 user_key.id.not_blank=ApiKey ID不能为空 expire_time_not_null=过期时间不能为空 -permission.organization.name=组织 \ No newline at end of file +permission.organization.name=组织 +swagger_parse_error_with_auth=Swagger 解析失败,请确认认证信息是否正确或文件格式是否正确! +swagger_parse_error=Swagger 解析失败,请确认文件格式是否正确! \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties index 5a06889233..6b3cd766dd 100644 --- a/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/commons_zh_TW.properties @@ -497,4 +497,6 @@ priority_is_null=優先級不能為空 apikey_has_expired=ApiKey 已過期 user_key.id.not_blank=ApiKey ID不能为空 expire_time_not_null=過期時間不能為空 -permission.organization.name=組織 \ No newline at end of file +permission.organization.name=組織 +swagger_parse_error_with_auth=Swagger 解析失敗,請檢查 Swagger 接口是否需要認證 +swagger_parse_error=Swagger 解析失敗 \ No newline at end of file diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java index 480ac78468..5cfa8cc770 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/controller/definition/ApiDefinitionController.java @@ -4,6 +4,8 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.api.domain.ApiDefinition; import io.metersphere.api.dto.definition.*; +import io.metersphere.api.dto.definition.importdto.ApiDefinitionImport; +import io.metersphere.api.dto.request.ImportRequest; import io.metersphere.api.service.definition.ApiDefinitionLogService; import io.metersphere.api.service.definition.ApiDefinitionService; import io.metersphere.sdk.constants.PermissionConstants; @@ -73,6 +75,7 @@ public class ApiDefinitionController { public void delete(@Validated @RequestBody ApiDefinitionDeleteRequest request) { apiDefinitionService.delete(request, SessionUtils.getUserId()); } + @PostMapping(value = "/batch-del") @Operation(summary = "接口测试-接口管理-批量删除接口定义到回收站") @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE) @@ -141,6 +144,7 @@ public class ApiDefinitionController { public void recover(@Validated @RequestBody ApiDefinitionDeleteRequest request) { apiDefinitionService.recover(request, SessionUtils.getUserId()); } + @PostMapping(value = "/trash-del") @Operation(summary = "接口测试-接口管理-删除回收站接口定义") @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DELETE) @@ -149,6 +153,7 @@ public class ApiDefinitionController { public void trashDel(@Validated @RequestBody ApiDefinitionDeleteRequest request) { apiDefinitionService.trashDel(request, SessionUtils.getUserId()); } + @PostMapping(value = "/batch-recover") @Operation(summary = "接口测试-接口管理-批量从回收站恢复接口定义") @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_RECOVER) @@ -190,4 +195,11 @@ public class ApiDefinitionController { return apiDefinitionService.getDocInfo(request); } + @PostMapping(value = "/import", consumes = {"multipart/form-data"}) + @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_IMPORT) + @Operation(summary = "接口测试-接口管理-导入接口定义") + public ApiDefinitionImport testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ImportRequest request) { + return apiDefinitionService.apiTestImport(file, request); + } + } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithData.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithData.java new file mode 100644 index 0000000000..281f110fc7 --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithData.java @@ -0,0 +1,22 @@ +package io.metersphere.api.dto.definition.importdto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Data +public class ApiDeatlWithData { + @Schema(description = "相同的数据的key") + List sameList = new ArrayList<>(); + @Schema(description = "不同的数据的key") + List differenceList = new ArrayList<>(); + @Schema(description = "数据库中存在的数据") + Map apiDateMap = new HashMap<>(); + @Schema(description = "导入的数据") + Map importDataMap = new HashMap<>(); + +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithDataUpdate.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithDataUpdate.java new file mode 100644 index 0000000000..1e169d9201 --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDeatlWithDataUpdate.java @@ -0,0 +1,21 @@ +package io.metersphere.api.dto.definition.importdto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Data +public class ApiDeatlWithDataUpdate { + @Schema(description = "需要更新模块的数据") + List updateModuleData = new ArrayList<>(); + @Schema(description = "需要更新接口的数据") + List updateRequestData = new ArrayList<>(); + @Schema(description = "需要新增的接口数据") + List addModuleData = new ArrayList<>(); + @Schema(description = "需要新增的日志数据") + Map logData; + +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImport.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImport.java new file mode 100644 index 0000000000..b87a295299 --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImport.java @@ -0,0 +1,18 @@ +package io.metersphere.api.dto.definition.importdto; + +import io.metersphere.api.dto.definition.ApiTestCaseDTO; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class ApiDefinitionImport { + private String projectName; + private String protocol; + private List data; + + // 新版本带用例导出 + private List cases = new ArrayList<>(); + +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/importdto/ApiDefinitionImportDTO.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImportDTO.java similarity index 92% rename from backend/services/api-test/src/main/java/io/metersphere/api/dto/importdto/ApiDefinitionImportDTO.java rename to backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImportDTO.java index f9093adf70..b05db3a8f9 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/importdto/ApiDefinitionImportDTO.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/importdto/ApiDefinitionImportDTO.java @@ -1,4 +1,4 @@ -package io.metersphere.api.dto.importdto; +package io.metersphere.api.dto.definition.importdto; import io.metersphere.api.domain.ApiDefinition; import io.metersphere.api.dto.definition.HttpResponse; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ImportRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ImportRequest.java index ccacc55921..5423253c6d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ImportRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/ImportRequest.java @@ -1,31 +1,45 @@ package io.metersphere.api.dto.request; +import io.metersphere.api.dto.request.http.Header; +import io.metersphere.api.dto.request.http.QueryParam; +import io.metersphere.api.dto.request.http.auth.HTTPAuth; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.util.List; + @Data public class ImportRequest { private String id; private String name; private String moduleId; - private String environmentId; private String projectId; - private String platform; + @Schema(description = "导入的swagger地址") private String swaggerUrl; - - //导入策略 - private String modeId; + @Schema(description = "如果是定时任务的时候 需要传入创建人id") private String userId; private String versionId; // 新导入选择的版本 private String updateVersionId; // 覆盖导入已存在的接口选择的版本 private String defaultVersion; + private String platform; //调用类型 private String type; - // 是否开启自定义ID - private Boolean openCustomNum = false; - // 是否覆盖模块 + @Schema(description = "是否覆盖模块") private Boolean coverModule; + @Schema(description = "是否同步导入用例") + private Boolean syncCase; + @Schema(description = "是否覆盖数据") + private Boolean coverData; // 当前协议 private String protocol; //上传文件来源,目前用于辨别是否是idea插件 private String origin; + @Schema(description = "swagger的请求头参数") + private List
headers; + @Schema(description = "swagger的请求参数") + private List arguments; + @Schema(description = "swagger的认证参数") + private HTTPAuth authManager; + @Schema(description = "唯一标识 默认是Method & Path 后续估计会补充") + private String uniquelyIdentifies = "Method & Path"; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/JsonBody.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/JsonBody.java index 5886ceb193..82ca9e7378 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/JsonBody.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/JsonBody.java @@ -1,5 +1,6 @@ package io.metersphere.api.dto.request.http.body; +import io.metersphere.api.dto.schema.JsonSchemaItem; import lombok.Data; /** @@ -20,5 +21,9 @@ public class JsonBody { * 启用 json-schema 时的参数对象 * todo json-schema 编辑器待调研,暂时使用 Object 类型 */ - private Object jsonSchema; + private JsonSchemaItem jsonSchema; + /** + * 是否开启转换 + */ + private Boolean enable = false; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/schema/JsonSchemaItem.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/schema/JsonSchemaItem.java new file mode 100644 index 0000000000..6fd5c16f60 --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/schema/JsonSchemaItem.java @@ -0,0 +1,58 @@ +package io.metersphere.api.dto.schema; + + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@Data +public class JsonSchemaItem { + private Object example; + private String id; + private String title; + private String type = "string"; + private String description; + private JsonSchemaItem items; + private Map mock; + private Map properties; + private JsonSchemaItem additionalProperties; + private List required; + private String pattern; + private Integer maxLength; + private Integer minLength; + private BigDecimal minimum; + private BigDecimal maximum; + private String schema; + private String format; + private List enumString; + private List enumInteger; + private List enumNumber; + private Map extensions = null; + + + public JsonSchemaItem() { + this.mock = new LinkedHashMap<>(); + this.mock.put("mock", ""); + } + + public JsonSchemaItem(String type) { + this.type = type; + this.initParam(type); + } + + public void setType(String type) { + this.type = type; + this.initParam(type); + } + + private void initParam(String type) { + if (type.equals("object")) { + this.properties = new LinkedHashMap<>(); + } else if (type.equals("array")) { + this.items = new JsonSchemaItem(); + } + } +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/enums/PropertyConstant.java b/backend/services/api-test/src/main/java/io/metersphere/api/enums/PropertyConstant.java new file mode 100644 index 0000000000..32b120d83a --- /dev/null +++ b/backend/services/api-test/src/main/java/io/metersphere/api/enums/PropertyConstant.java @@ -0,0 +1,33 @@ +package io.metersphere.api.enums; + +public class PropertyConstant { + public final static String REQUIRED = "required"; + public final static String ALL_OF = "allOf"; + public final static String PROPERTIES = "properties"; + public final static String ADDITIONAL_PROPERTIES = "additionalProperties"; + public final static String TYPE = "type"; + public final static String MS_OBJECT = "MS-OBJECT"; + public final static String ARRAY = "array"; + public final static String OBJECT = "object"; + public final static String DEFAULT = "default"; + public final static String STRING = "string"; + public final static String BOOLEAN = "boolean"; + public final static String NUMBER = "number"; + public final static String INTEGER = "integer"; + public final static String MOCK = "mock"; + public final static String NULL = "null"; + public final static String ENUM = "enum"; + public final static String ITEMS = "items"; + public final static String ITEM = "_item"; + public final static String NONE = "none"; + public final static String ROOT = "root"; + public final static String XML_PATH = "XML_PATH"; + public final static String ASS_OPTION = "ASS_OPTION"; + public final static String EXPECTED_VALUE = "EXPECTED_VALUE"; + public final static String ELEMENT_CONDITION = "ElementCondition"; + public final static String ENVIRONMENT = "useEnvironment"; + public final static String ENVIRONMENT_ID = "environmentId"; + public final static String DATASOURCE_ID = "dataSourceId"; + public final static String PROJECT_ID = "projectId"; + +} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java index 8aa429c161..6890d9fc62 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java @@ -2,7 +2,7 @@ package io.metersphere.api.mapper; import io.metersphere.api.domain.ApiDefinition; import io.metersphere.api.dto.definition.*; -import io.metersphere.api.dto.importdto.ApiDefinitionImportDTO; +import io.metersphere.api.dto.definition.importdto.ApiDefinitionImportDTO; import io.metersphere.system.dto.table.TableBatchProcessDTO; import org.apache.ibatis.annotations.Param; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml index 6cb1b45aa6..17094291cb 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml @@ -129,14 +129,14 @@ and deleted = #{deleted} - select api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`, api_definition.`path`, api_definition.version_id, - api_definition.ref_id + api_definition.ref_id, api_definition.module_id from api_definition LEFT JOIN project_version ON project_version.id = api_definition.version_id - where api_definition.deleted = true + where api_definition.deleted = false