refactor(接口测试): 接口列表支持多协议查询
This commit is contained in:
parent
e7304e5272
commit
f1bc941411
|
@ -1,6 +1,5 @@
|
||||||
package io.metersphere.request;
|
package io.metersphere.request;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.validation.groups.Created;
|
import io.metersphere.validation.groups.Created;
|
||||||
import io.metersphere.validation.groups.Updated;
|
import io.metersphere.validation.groups.Updated;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -8,6 +7,7 @@ import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -44,7 +44,7 @@ public class AssociateOtherCaseRequest {
|
||||||
private String sourceId;
|
private String sourceId;
|
||||||
|
|
||||||
@Schema(description = "接口用例的接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口用例的接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
private List<String> protocols = new ArrayList<>();
|
||||||
|
|
||||||
@Schema(description = "关联用例的类型(API,SCENARIO,UI,PERFORMANCE)", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "关联用例的类型(API,SCENARIO,UI,PERFORMANCE)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{associate_other_case_request.type.not_blank}")
|
@NotBlank(message = "{associate_other_case_request.type.not_blank}")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package io.metersphere.request;
|
package io.metersphere.request;
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
@ -11,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -45,9 +45,7 @@ public class TestCasePageProviderRequest extends BaseProviderCondition implement
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
private List<String> protocols = new ArrayList<>();
|
||||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
|
|
||||||
@Schema(description = "模块ID")
|
@Schema(description = "模块ID")
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
package io.metersphere.api.dto.definition;
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,9 +29,8 @@ public class ApiDefinitionBatchRequest extends TableBatchProcessDTO implements S
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_debug.protocol.not_blank}")
|
@NotEmpty(message = "{api_debug.protocol.not_blank}")
|
||||||
@Size(min = 1, max = 20, message = "{api_debug.protocol.length_range}")
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
|
|
||||||
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
|
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package io.metersphere.api.dto.definition;
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,8 +33,8 @@ public class ApiDefinitionDocRequest implements Serializable {
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@Size(min = 1, max = 20, message = "{api_debug.protocol.length_range}")
|
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
|
|
||||||
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
|
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
|
@ -34,5 +34,7 @@ public class ApiDefinitionMockDTO extends ApiDefinitionMock {
|
||||||
|
|
||||||
@Schema(description = "接口类型")
|
@Schema(description = "接口类型")
|
||||||
private String apiMethod;
|
private String apiMethod;
|
||||||
|
@Schema(description = "接口协议")
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package io.metersphere.api.dto.definition;
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,9 +27,8 @@ public class ApiDefinitionPageRequest extends BasePageRequest {
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
|
|
||||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.project_id.not_blank}")
|
@NotBlank(message = "{api_definition.project_id.not_blank}")
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package io.metersphere.api.dto.definition;
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.system.dto.sdk.BaseCondition;
|
import io.metersphere.system.dto.sdk.BaseCondition;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -15,9 +16,8 @@ public class ApiModuleRequest extends BaseCondition {
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
||||||
@Schema(description = "协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition_module.protocol.not_blank}")
|
@NotEmpty(message = "{api_definition_module.protocol.not_blank}")
|
||||||
@Size(min = 1, max = 20, message = "{api_definition_module.protocol.length_range}")
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition_module.project_id.not_blank}")
|
@NotBlank(message = "{api_definition_module.project_id.not_blank}")
|
||||||
@Size(min = 1, max = 50, message = "{api_definition_module.project_id.length_range}")
|
@Size(min = 1, max = 50, message = "{api_definition_module.project_id.length_range}")
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package io.metersphere.api.dto.definition;
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -27,9 +28,8 @@ public class ApiTestCaseBatchRequest extends TableBatchProcessDTO implements Ser
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
private List<String> protocols = new ArrayList<>();
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
|
|
||||||
@Schema(description = "模块ID")
|
@Schema(description = "模块ID")
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
package io.metersphere.api.dto.definition;
|
package io.metersphere.api.dto.definition;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -29,9 +30,8 @@ public class ApiTestCasePageRequest extends BasePageRequest implements Serializa
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
|
|
||||||
@Schema(description = "模块ID")
|
@Schema(description = "模块ID")
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package io.metersphere.api.dto.definition.request;
|
package io.metersphere.api.dto.definition.request;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,9 +35,8 @@ public class ApiDefinitionMockPageRequest extends BasePageRequest {
|
||||||
private String apiDefinitionId;
|
private String apiDefinitionId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
@NotEmpty
|
||||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
|
||||||
|
|
||||||
@Schema(description = "模块ID")
|
@Schema(description = "模块ID")
|
||||||
private List<@NotBlank String> moduleIds;
|
private List<@NotBlank String> moduleIds;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package io.metersphere.api.dto.scenario;
|
package io.metersphere.api.dto.scenario;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.ModuleConstants;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -24,8 +24,8 @@ public class ScenarioSystemRequest {
|
||||||
@Size(min = 1, max = 50, message = "{api_scenario.project_id.length_range}")
|
@Size(min = 1, max = 50, message = "{api_scenario.project_id.length_range}")
|
||||||
private String projectId;
|
private String projectId;
|
||||||
@Schema(description = "协议 接口和用例的时候 是必传的", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "协议 接口和用例的时候 是必传的", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank
|
@NotEmpty
|
||||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||||
@Schema(description = "版本id")
|
@Schema(description = "版本id")
|
||||||
private String versionId;
|
private String versionId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public interface ExtApiDefinitionMapper {
|
||||||
|
|
||||||
Long getPos(@Param("projectId") String projectId);
|
Long getPos(@Param("projectId") String projectId);
|
||||||
|
|
||||||
List<String> getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocol") String protocol, @Param("deleted") boolean deleted);
|
List<String> getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocols") List<String> protocols, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
List<String> getRefIds(@Param("ids") List<String> ids, @Param("deleted") boolean deleted);
|
List<String> getRefIds(@Param("ids") List<String> ids, @Param("deleted") boolean deleted);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,13 @@
|
||||||
<select id="getIds" resultType="java.lang.String">
|
<select id="getIds" resultType="java.lang.String">
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM api_definition
|
FROM api_definition
|
||||||
where project_id = #{projectId} AND protocol = #{protocol} and deleted = #{deleted}
|
where project_id = #{projectId} and deleted = #{deleted}
|
||||||
|
<if test="protocols != null and protocols.size() > 0">
|
||||||
|
AND protocol in
|
||||||
|
<foreach collection="protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() != 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() != 0">
|
||||||
AND module_id IN
|
AND module_id IN
|
||||||
<foreach collection="request.moduleIds" item="item" open="(" separator="," close=")">
|
<foreach collection="request.moduleIds" item="item" open="(" separator="," close=")">
|
||||||
|
@ -228,8 +234,11 @@
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_definition.project_id = #{request.projectId}
|
and api_definition.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol != ''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
AND api_definition.protocol = #{request.protocol}
|
and api_definition.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and api_definition.module_id in
|
and api_definition.module_id in
|
||||||
|
@ -265,8 +274,11 @@
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_definition.project_id = #{request.projectId}
|
and api_definition.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol != ''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
AND api_definition.protocol = #{request.protocol}
|
and api_definition.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and api_definition.module_id in
|
and api_definition.module_id in
|
||||||
|
@ -501,8 +513,11 @@
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_definition.project_id = #{request.projectId}
|
and api_definition.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol != ''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
AND api_definition.protocol = #{request.protocol}
|
AND api_definition.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and api_definition.module_id in
|
and api_definition.module_id in
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<select id="list" resultMap="ApiDefinitionMockDTO">
|
<select id="list" resultMap="ApiDefinitionMockDTO">
|
||||||
select
|
select
|
||||||
m.id, m.create_time, m.update_time, m.create_user, m.`name`, m.tags, m.`enable`, m.expect_num, m.project_id, m.status_code,
|
m.id, m.create_time, m.update_time, m.create_user, m.`name`, m.tags, m.`enable`, m.expect_num, m.project_id, m.status_code,
|
||||||
m.api_definition_id, u.name as create_user_name, d.path as api_path, d.method as apiMethod
|
m.api_definition_id, u.name as create_user_name, d.path as api_path, d.method as apiMethod, d.protocol as protocol
|
||||||
from api_definition_mock m
|
from api_definition_mock m
|
||||||
left join `api_definition` d on d.id = m.api_definition_id
|
left join `api_definition` d on d.id = m.api_definition_id
|
||||||
left join `user` u on u.id = m.create_user
|
left join `user` u on u.id = m.create_user
|
||||||
|
@ -62,9 +62,13 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<sql id="queryWhereConditionByBatch">
|
<sql id="queryWhereConditionByBatch">
|
||||||
<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and a.protocol = #{request.protocol}
|
and a.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
and m.api_definition_id = #{request.apiDefinitionId}
|
and m.api_definition_id = #{request.apiDefinitionId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -107,8 +111,11 @@
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId != ''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId != ''">
|
||||||
and m.api_definition_id = #{request.apiDefinitionId}
|
and m.api_definition_id = #{request.apiDefinitionId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and d.protocol = #{request.protocol}
|
and d.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and d.module_id in
|
and d.module_id in
|
||||||
|
|
|
@ -176,8 +176,11 @@
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_definition.project_id = #{request.projectId}
|
and api_definition.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol != ''">
|
<if test="request.protocols != null and request.protocols.size() >0 ">
|
||||||
AND api_definition.protocol = #{request.protocol}
|
AND api_definition.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and api_definition.module_id in
|
and api_definition.module_id in
|
||||||
|
|
|
@ -284,8 +284,11 @@
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_test_case.project_id = #{request.projectId}
|
and api_test_case.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol != ''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
AND api_definition.protocol = #{request.protocol}
|
AND api_definition.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||||
and api_definition.module_id in
|
and api_definition.module_id in
|
||||||
|
@ -412,8 +415,11 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryWhereConditionByBatch">
|
<sql id="queryWhereConditionByBatch">
|
||||||
<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and a.protocol = #{request.protocol}
|
and a.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
and atc.api_definition_id = #{request.apiDefinitionId}
|
and atc.api_definition_id = #{request.apiDefinitionId}
|
||||||
|
@ -444,8 +450,11 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="queryWhereCondition">
|
<sql id="queryWhereCondition">
|
||||||
<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and a.protocol = #{request.protocol}
|
and a.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
and atc.api_definition_id = #{request.apiDefinitionId}
|
and atc.api_definition_id = #{request.apiDefinitionId}
|
||||||
|
@ -552,8 +561,11 @@
|
||||||
#{moduleId}
|
#{moduleId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and ad.protocol = #{request.protocol}
|
and ad.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" open="(" separator="," close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
and ac.api_definition_id = #{request.apiDefinitionId}
|
and ac.api_definition_id = #{request.apiDefinitionId}
|
||||||
|
@ -575,8 +587,12 @@
|
||||||
#{moduleId}
|
#{moduleId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and ad.protocol = #{request.protocol}
|
and ad.protocol in
|
||||||
|
<foreach collection="request.protocols" item="protocol" open="(" separator="," close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
and ac.api_definition_id = #{request.apiDefinitionId}
|
and ac.api_definition_id = #{request.apiDefinitionId}
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class ApiDefinitionImportUtilService {
|
||||||
//查询数据库中所有的数据, 用于判断是否重复
|
//查询数据库中所有的数据, 用于判断是否重复
|
||||||
ApiDefinitionPageRequest pageRequest = new ApiDefinitionPageRequest();
|
ApiDefinitionPageRequest pageRequest = new ApiDefinitionPageRequest();
|
||||||
pageRequest.setProjectId(request.getProjectId());
|
pageRequest.setProjectId(request.getProjectId());
|
||||||
pageRequest.setProtocol(request.getProtocol());
|
pageRequest.setProtocols(List.of(request.getProtocol()));
|
||||||
//TODO 如果是有版本的话 需要加上版本的判断
|
//TODO 如果是有版本的话 需要加上版本的判断
|
||||||
List<ApiDefinitionImportDetail> apiLists = extApiDefinitionMapper.importList(pageRequest);
|
List<ApiDefinitionImportDetail> apiLists = extApiDefinitionMapper.importList(pageRequest);
|
||||||
List<BaseTreeNode> apiModules = this.buildTreeData(request.getProjectId(), request.getProtocol());
|
List<BaseTreeNode> apiModules = this.buildTreeData(request.getProjectId(), request.getProtocol());
|
||||||
|
@ -812,7 +812,7 @@ public class ApiDefinitionImportUtilService {
|
||||||
public List<BaseTreeNode> buildTreeData(String projectId, String protocol) {
|
public List<BaseTreeNode> buildTreeData(String projectId, String protocol) {
|
||||||
ApiModuleRequest request = new ApiModuleRequest();
|
ApiModuleRequest request = new ApiModuleRequest();
|
||||||
request.setProjectId(projectId);
|
request.setProjectId(projectId);
|
||||||
request.setProtocol(protocol);
|
request.setProtocols(List.of(protocol));
|
||||||
List<BaseTreeNode> apiModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(request);
|
List<BaseTreeNode> apiModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(request);
|
||||||
return this.buildTreeAndCountResource(apiModuleList, true, Translator.get(UNPLANNED_API));
|
return this.buildTreeAndCountResource(apiModuleList, true, Translator.get(UNPLANNED_API));
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService {
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
.andProjectIdEqualTo(request.getProjectId())
|
.andProjectIdEqualTo(request.getProjectId())
|
||||||
.andDeletedEqualTo(true)
|
.andDeletedEqualTo(true)
|
||||||
.andProtocolEqualTo(request.getProtocol());
|
.andProtocolIn(request.getProtocols());
|
||||||
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
|
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
|
||||||
if (CollectionUtils.isEmpty(apiDefinitions)) {
|
if (CollectionUtils.isEmpty(apiDefinitions)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
@ -315,7 +315,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService {
|
||||||
EnvApiTreeDTO envApiTreeDTO = new EnvApiTreeDTO();
|
EnvApiTreeDTO envApiTreeDTO = new EnvApiTreeDTO();
|
||||||
ApiModuleRequest apiModuleRequest = new ApiModuleRequest();
|
ApiModuleRequest apiModuleRequest = new ApiModuleRequest();
|
||||||
apiModuleRequest.setProjectId(request.getProjectId());
|
apiModuleRequest.setProjectId(request.getProjectId());
|
||||||
apiModuleRequest.setProtocol(ModuleConstants.NODE_PROTOCOL_HTTP);
|
apiModuleRequest.setProtocols(List.of(ModuleConstants.NODE_PROTOCOL_HTTP));
|
||||||
List<BaseTreeNode> fileModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(apiModuleRequest);
|
List<BaseTreeNode> fileModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(apiModuleRequest);
|
||||||
List<BaseTreeNode> baseTreeNodes = super.buildTreeAndCountResource(fileModuleList, true, Translator.get(UNPLANNED_API));
|
List<BaseTreeNode> baseTreeNodes = super.buildTreeAndCountResource(fileModuleList, true, Translator.get(UNPLANNED_API));
|
||||||
envApiTreeDTO.setModuleTree(baseTreeNodes);
|
envApiTreeDTO.setModuleTree(baseTreeNodes);
|
||||||
|
|
|
@ -291,7 +291,7 @@ public class ApiDefinitionService extends MoveNodeService {
|
||||||
|
|
||||||
public void batchUpdate(ApiDefinitionBatchUpdateRequest request, String userId) {
|
public void batchUpdate(ApiDefinitionBatchUpdateRequest request, String userId) {
|
||||||
ProjectService.checkResourceExist(request.getProjectId());
|
ProjectService.checkResourceExist(request.getProjectId());
|
||||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId);
|
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
|
||||||
// 记录更新前的数据
|
// 记录更新前的数据
|
||||||
apiDefinitionLogService.batchUpdateLog(ids, userId, request.getProjectId());
|
apiDefinitionLogService.batchUpdateLog(ids, userId, request.getProjectId());
|
||||||
if (CollectionUtils.isNotEmpty(ids)) {
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
|
@ -417,14 +417,14 @@ public class ApiDefinitionService extends MoveNodeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchDeleteToGc(ApiDefinitionBatchDeleteRequest request, String userId) {
|
public void batchDeleteToGc(ApiDefinitionBatchDeleteRequest request, String userId) {
|
||||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId);
|
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
|
||||||
if (CollectionUtils.isNotEmpty(ids)) {
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
handleDeleteApiDefinition(ids, request.getDeleteAllVersion(), request.getProjectId(), userId, true);
|
handleDeleteApiDefinition(ids, request.getDeleteAllVersion(), request.getProjectId(), userId, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchMove(ApiDefinitionBatchMoveRequest request, String userId) {
|
public void batchMove(ApiDefinitionBatchMoveRequest request, String userId) {
|
||||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId);
|
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
|
||||||
if (!ids.isEmpty()) {
|
if (!ids.isEmpty()) {
|
||||||
// 移动接口所有版本引用的数据
|
// 移动接口所有版本引用的数据
|
||||||
List<String> refIds = extApiDefinitionMapper.getRefIds(ids, false);
|
List<String> refIds = extApiDefinitionMapper.getRefIds(ids, false);
|
||||||
|
@ -805,14 +805,14 @@ public class ApiDefinitionService extends MoveNodeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchRecover(ApiDefinitionBatchRequest request, String userId) {
|
public void batchRecover(ApiDefinitionBatchRequest request, String userId) {
|
||||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), true, userId);
|
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId);
|
||||||
if (CollectionUtils.isNotEmpty(ids)) {
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
handleRecoverApiDefinition(ids, userId, request.getProjectId(), true);
|
handleRecoverApiDefinition(ids, userId, request.getProjectId(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchDelete(ApiDefinitionBatchRequest request, String userId) {
|
public void batchDelete(ApiDefinitionBatchRequest request, String userId) {
|
||||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), true, userId);
|
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId);
|
||||||
if (CollectionUtils.isNotEmpty(ids)) {
|
if (CollectionUtils.isNotEmpty(ids)) {
|
||||||
handleTrashDelApiDefinition(ids, userId, request.getProjectId(), true);
|
handleTrashDelApiDefinition(ids, userId, request.getProjectId(), true);
|
||||||
}
|
}
|
||||||
|
@ -864,12 +864,12 @@ public class ApiDefinitionService extends MoveNodeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取批量操作选中的ID
|
// 获取批量操作选中的ID
|
||||||
public <T> List<String> getBatchApiIds(T dto, String projectId, String protocol, boolean deleted, String userId) {
|
public <T> List<String> getBatchApiIds(T dto, String projectId, List<String> protocols, boolean deleted, String userId) {
|
||||||
TableBatchProcessDTO request = (TableBatchProcessDTO) dto;
|
TableBatchProcessDTO request = (TableBatchProcessDTO) dto;
|
||||||
if (request.isSelectAll()) {
|
if (request.isSelectAll()) {
|
||||||
// 全选
|
// 全选
|
||||||
CustomFieldUtils.setBaseQueryRequestCustomMultipleFields(request.getCondition(), userId);
|
CustomFieldUtils.setBaseQueryRequestCustomMultipleFields(request.getCondition(), userId);
|
||||||
List<String> ids = extApiDefinitionMapper.getIds(request, projectId, protocol, deleted);
|
List<String> ids = extApiDefinitionMapper.getIds(request, projectId, protocols, deleted);
|
||||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||||
ids.removeAll(request.getExcludeIds());
|
ids.removeAll(request.getExcludeIds());
|
||||||
}
|
}
|
||||||
|
|
|
@ -689,6 +689,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002", "1005"));
|
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002", "1005"));
|
||||||
apiDefinitionBatchUpdateRequest.setExcludeIds(List.of("1005"));
|
apiDefinitionBatchUpdateRequest.setExcludeIds(List.of("1005"));
|
||||||
apiDefinitionBatchUpdateRequest.setSelectAll(false);
|
apiDefinitionBatchUpdateRequest.setSelectAll(false);
|
||||||
|
apiDefinitionBatchUpdateRequest.setProtocols(List.of("HTTP"));
|
||||||
apiDefinitionBatchUpdateRequest.setType("tags");
|
apiDefinitionBatchUpdateRequest.setType("tags");
|
||||||
// 修改标签,追加
|
// 修改标签,追加
|
||||||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002"));
|
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002"));
|
||||||
|
@ -814,6 +815,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
request.setSelectIds(List.of("1001", "1002", "1005"));
|
request.setSelectIds(List.of("1001", "1002", "1005"));
|
||||||
request.setExcludeIds(List.of("1005"));
|
request.setExcludeIds(List.of("1005"));
|
||||||
request.setSelectAll(false);
|
request.setSelectAll(false);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
this.requestPostWithOkAndReturn(BATCH_MOVE, request);
|
this.requestPostWithOkAndReturn(BATCH_MOVE, request);
|
||||||
// @@校验日志
|
// @@校验日志
|
||||||
|
|
||||||
|
@ -918,6 +920,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setDeleted(false);
|
request.setDeleted(false);
|
||||||
request.setSort(Map.of("createTime", "asc"));
|
request.setSort(Map.of("createTime", "asc"));
|
||||||
// "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED"
|
// "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED"
|
||||||
|
@ -1019,6 +1022,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
apiDefinition = apiDefinitionMapper.selectByPrimaryKey("1001");
|
apiDefinition = apiDefinitionMapper.selectByPrimaryKey("1001");
|
||||||
request.setApiId(apiDefinition.getId());
|
request.setApiId(apiDefinition.getId());
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setType(ApiDefinitionDocType.API.name());
|
request.setType(ApiDefinitionDocType.API.name());
|
||||||
// @@请求成功
|
// @@请求成功
|
||||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(DOC, request);
|
MvcResult mvcResult = this.requestPostWithOkAndReturn(DOC, request);
|
||||||
|
@ -1111,6 +1115,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
// @@模块查看文档
|
// @@模块查看文档
|
||||||
request.setApiId(null);
|
request.setApiId(null);
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setType(ApiDefinitionDocType.MODULE.name());
|
request.setType(ApiDefinitionDocType.MODULE.name());
|
||||||
request.setModuleIds(List.of("1001001"));
|
request.setModuleIds(List.of("1001001"));
|
||||||
MvcResult mvcResultModule = this.requestPostWithOkAndReturn(DOC, request);
|
MvcResult mvcResultModule = this.requestPostWithOkAndReturn(DOC, request);
|
||||||
|
@ -1325,6 +1330,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
request.setSelectIds(List.of("1004"));
|
request.setSelectIds(List.of("1004"));
|
||||||
request.setDeleteAllVersion(false);
|
request.setDeleteAllVersion(false);
|
||||||
request.setSelectAll(false);
|
request.setSelectAll(false);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
this.requestPostWithOkAndReturn(BATCH_DELETE_TO_GC, request);
|
this.requestPostWithOkAndReturn(BATCH_DELETE_TO_GC, request);
|
||||||
// @@校验日志
|
// @@校验日志
|
||||||
checkLogModelList.add(new CheckLogModel("1004", OperationLogType.DELETE, BATCH_DELETE_TO_GC));
|
checkLogModelList.add(new CheckLogModel("1004", OperationLogType.DELETE, BATCH_DELETE_TO_GC));
|
||||||
|
@ -1399,6 +1405,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
LogUtils.info("batch recover api test");
|
LogUtils.info("batch recover api test");
|
||||||
ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest();
|
ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest();
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
// 恢复选中
|
// 恢复选中
|
||||||
request.setSelectIds(List.of("1002", "1004", "1005"));
|
request.setSelectIds(List.of("1002", "1004", "1005"));
|
||||||
request.setExcludeIds(List.of("1005"));
|
request.setExcludeIds(List.of("1005"));
|
||||||
|
@ -1480,6 +1487,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
||||||
LogUtils.info("batch trash delete api test");
|
LogUtils.info("batch trash delete api test");
|
||||||
ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest();
|
ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest();
|
||||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
|
|
||||||
// 删除选中
|
// 删除选中
|
||||||
request.setSelectIds(List.of("1003"));
|
request.setSelectIds(List.of("1003"));
|
||||||
|
|
|
@ -525,6 +525,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest {
|
||||||
request.setApiDefinitionId(apiDefinitionMock.getApiDefinitionId());
|
request.setApiDefinitionId(apiDefinitionMock.getApiDefinitionId());
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setSort(Map.of("createTime", "asc"));
|
request.setSort(Map.of("createTime", "asc"));
|
||||||
// "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED"
|
// "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED"
|
||||||
switch (search) {
|
switch (search) {
|
||||||
|
@ -600,6 +601,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest {
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
ApiDefinitionMockExample example = new ApiDefinitionMockExample();
|
ApiDefinitionMockExample example = new ApiDefinitionMockExample();
|
||||||
|
|
|
@ -815,7 +815,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
||||||
public void TestModuleCountSuccess() throws Exception {
|
public void TestModuleCountSuccess() throws Exception {
|
||||||
this.preliminaryData();
|
this.preliminaryData();
|
||||||
ApiModuleRequest request = new ApiModuleRequest() {{
|
ApiModuleRequest request = new ApiModuleRequest() {{
|
||||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||||
this.setProjectId(project.getId());
|
this.setProjectId(project.getId());
|
||||||
}};
|
}};
|
||||||
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_FILE_MODULE_COUNT, request);
|
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_FILE_MODULE_COUNT, request);
|
||||||
|
@ -879,7 +879,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
||||||
apiDefinition.setDeleted(true);
|
apiDefinition.setDeleted(true);
|
||||||
apiDefinitionMapper.updateByExampleSelective(apiDefinition, example);
|
apiDefinitionMapper.updateByExampleSelective(apiDefinition, example);
|
||||||
MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_TREE, new ApiModuleRequest() {{
|
MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_TREE, new ApiModuleRequest() {{
|
||||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||||
this.setProjectId(project.getId());
|
this.setProjectId(project.getId());
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
@ -892,7 +892,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
||||||
@Order(12)
|
@Order(12)
|
||||||
public void getModuleTrashTreeCount() throws Exception {
|
public void getModuleTrashTreeCount() throws Exception {
|
||||||
ApiModuleRequest request = new ApiModuleRequest() {{
|
ApiModuleRequest request = new ApiModuleRequest() {{
|
||||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||||
this.setProjectId(project.getId());
|
this.setProjectId(project.getId());
|
||||||
}};
|
}};
|
||||||
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_COUNT, request);
|
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_COUNT, request);
|
||||||
|
@ -954,11 +954,11 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
||||||
|
|
||||||
private List<BaseTreeNode> getModuleTreeNode() throws Exception {
|
private List<BaseTreeNode> getModuleTreeNode() throws Exception {
|
||||||
MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TREE, new ApiModuleRequest() {{
|
MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TREE, new ApiModuleRequest() {{
|
||||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||||
this.setProjectId(project.getId());
|
this.setProjectId(project.getId());
|
||||||
}});
|
}});
|
||||||
this.requestPostWithOkAndReturn(URL_MODULE_ONLY_TREE, new ApiModuleRequest() {{
|
this.requestPostWithOkAndReturn(URL_MODULE_ONLY_TREE, new ApiModuleRequest() {{
|
||||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||||
this.setProjectId(project.getId());
|
this.setProjectId(project.getId());
|
||||||
}});
|
}});
|
||||||
String returnData = result.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String returnData = result.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
|
|
@ -2829,7 +2829,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
||||||
|
|
||||||
ScenarioSystemRequest scenarioSystemRequest = new ScenarioSystemRequest();
|
ScenarioSystemRequest scenarioSystemRequest = new ScenarioSystemRequest();
|
||||||
scenarioSystemRequest.setProjectId(DEFAULT_PROJECT_ID);
|
scenarioSystemRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
scenarioSystemRequest.setProtocol("HTTP");
|
scenarioSystemRequest.setProtocols(List.of("HTTP"));
|
||||||
scenarioSystemRequest.setModuleIds(List.of("test-default"));
|
scenarioSystemRequest.setModuleIds(List.of("test-default"));
|
||||||
ApiScenarioSystemRequest apiScenarioSystemRequest = new ApiScenarioSystemRequest();
|
ApiScenarioSystemRequest apiScenarioSystemRequest = new ApiScenarioSystemRequest();
|
||||||
apiScenarioSystemRequest.setApiRequest(scenarioSystemRequest);
|
apiScenarioSystemRequest.setApiRequest(scenarioSystemRequest);
|
||||||
|
|
|
@ -508,6 +508,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
apiRunModeRequest.setIntegratedReportName("aaaa");
|
apiRunModeRequest.setIntegratedReportName("aaaa");
|
||||||
apiRunModeRequest.setPoolId("poolId");
|
apiRunModeRequest.setPoolId("poolId");
|
||||||
request.setRunModeConfig(apiRunModeRequest);
|
request.setRunModeConfig(apiRunModeRequest);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
this.requestPostWithOk(BATCH_RUN, request);
|
this.requestPostWithOk(BATCH_RUN, request);
|
||||||
|
|
||||||
apiRunModeRequest.setIntegratedReport(false);
|
apiRunModeRequest.setIntegratedReport(false);
|
||||||
|
@ -833,6 +834,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
pageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
pageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
pageRequest.setPageSize(10);
|
pageRequest.setPageSize(10);
|
||||||
pageRequest.setCurrent(1);
|
pageRequest.setCurrent(1);
|
||||||
|
pageRequest.setProtocols(List.of("HTTP"));
|
||||||
MvcResult mvcResult = requestPostWithOkAndReturn(PAGE, pageRequest);
|
MvcResult mvcResult = requestPostWithOkAndReturn(PAGE, pageRequest);
|
||||||
Pager<?> returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
Pager<?> returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||||
//返回值不为空
|
//返回值不为空
|
||||||
|
@ -912,6 +914,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
request.setType("Tags");
|
request.setType("Tags");
|
||||||
request.setAppend(true);
|
request.setAppend(true);
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||||
|
@ -1086,6 +1089,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
pageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
pageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||||
pageRequest.setPageSize(10);
|
pageRequest.setPageSize(10);
|
||||||
pageRequest.setCurrent(1);
|
pageRequest.setCurrent(1);
|
||||||
|
pageRequest.setProtocols(List.of("HTTP"));
|
||||||
MvcResult mvcResult = requestPostWithOkAndReturn(TRASH_PAGE, pageRequest);
|
MvcResult mvcResult = requestPostWithOkAndReturn(TRASH_PAGE, pageRequest);
|
||||||
Pager<?> returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
Pager<?> returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||||
//返回值不为空
|
//返回值不为空
|
||||||
|
@ -1137,6 +1141,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
||||||
request.setSelectAll(false);
|
request.setSelectAll(false);
|
||||||
request.setSelectIds(List.of(apiTestCase.getId()));
|
request.setSelectIds(List.of(apiTestCase.getId()));
|
||||||
request.setExcludeIds(List.of(apiTestCase.getId()));
|
request.setExcludeIds(List.of(apiTestCase.getId()));
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
requestPostWithOkAndReturn(BATCH_RECOVER, request);
|
requestPostWithOkAndReturn(BATCH_RECOVER, request);
|
||||||
|
|
||||||
ApiDefinition apiDefinition = new ApiDefinition();
|
ApiDefinition apiDefinition = new ApiDefinition();
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class AssociateApiProviderTest extends BaseTest {
|
||||||
request.setProjectId("project-associate-case-test");
|
request.setProjectId("project-associate-case-test");
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setSort(new HashMap<>() {{
|
request.setSort(new HashMap<>() {{
|
||||||
put("createTime", "desc");
|
put("createTime", "desc");
|
||||||
}});
|
}});
|
||||||
|
@ -53,6 +54,7 @@ public class AssociateApiProviderTest extends BaseTest {
|
||||||
request.setProjectId("project-associate-case-test");
|
request.setProjectId("project-associate-case-test");
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setSort(new HashMap<>() {{
|
request.setSort(new HashMap<>() {{
|
||||||
put("createTime", "desc");
|
put("createTime", "desc");
|
||||||
}});
|
}});
|
||||||
|
@ -69,6 +71,7 @@ public class AssociateApiProviderTest extends BaseTest {
|
||||||
request.setSourceType("API");
|
request.setSourceType("API");
|
||||||
request.setSourceId("gyq_associate_case_id_1");
|
request.setSourceId("gyq_associate_case_id_1");
|
||||||
request.setSelectAll(true);
|
request.setSelectAll(true);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setProjectId("project-associate-case-test");
|
request.setProjectId("project-associate-case-test");
|
||||||
request.setExcludeIds(List.of("gyq_associate_api_case_id_2"));
|
request.setExcludeIds(List.of("gyq_associate_api_case_id_2"));
|
||||||
List<ApiTestCase> apiTestCases = provider.getSelectApiTestCases(request, false);
|
List<ApiTestCase> apiTestCases = provider.getSelectApiTestCases(request, false);
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
||||||
request.setProjectId("project_gyq_associate_test");
|
request.setProjectId("project_gyq_associate_test");
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setSort(new HashMap<>() {{
|
request.setSort(new HashMap<>() {{
|
||||||
put("createTime", "desc");
|
put("createTime", "desc");
|
||||||
}});
|
}});
|
||||||
|
@ -162,6 +163,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
||||||
request.setProjectId("project_gyq_associate_test");
|
request.setProjectId("project_gyq_associate_test");
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
List<TestCaseProviderDTO> apiTestCaseList = provider.getApiTestCaseList("functional_case_test", "case_id", "source_id", request);
|
List<TestCaseProviderDTO> apiTestCaseList = provider.getApiTestCaseList("functional_case_test", "case_id", "source_id", request);
|
||||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE, request);
|
MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE, request);
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
@ -195,6 +197,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
||||||
request.setProjectId("project_gyq_associate_test");
|
request.setProjectId("project_gyq_associate_test");
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE_MODULE_COUNT, request);
|
MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE_MODULE_COUNT, request);
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.plan.dto.request;
|
package io.metersphere.plan.dto.request;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -13,5 +14,5 @@ import java.util.List;
|
||||||
public class TestPlanApiCaseBatchRequest extends BasePlanCaseBatchRequest {
|
public class TestPlanApiCaseBatchRequest extends BasePlanCaseBatchRequest {
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||||
private List<String> protocols;
|
private List<@NotBlank String> protocols;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,9 +128,12 @@
|
||||||
<if test="request.projectId != null and request.projectId != ''">
|
<if test="request.projectId != null and request.projectId != ''">
|
||||||
and api_definition.project_id = #{request.projectId}
|
and api_definition.project_id = #{request.projectId}
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="request.protocol != null and request.protocol != ''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
AND api_definition.protocol = #{request.protocol}
|
AND api_definition.protocol in
|
||||||
</if>-->
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<include refid="filters">
|
<include refid="filters">
|
||||||
<property name="filter" value="request.filter"/>
|
<property name="filter" value="request.filter"/>
|
||||||
</include>
|
</include>
|
||||||
|
@ -437,9 +440,12 @@
|
||||||
|
|
||||||
|
|
||||||
<sql id="queryApiCaseWhereCondition">
|
<sql id="queryApiCaseWhereCondition">
|
||||||
<!--<if test="request.protocol != null and request.protocol!=''">
|
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||||
and a.protocol = #{request.protocol}
|
and a.protocol in
|
||||||
</if>-->
|
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||||
|
#{protocol}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||||
and atc.api_definition_id = #{request.apiDefinitionId}
|
and atc.api_definition_id = #{request.apiDefinitionId}
|
||||||
</if>
|
</if>
|
||||||
|
@ -639,7 +645,6 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="collectionCountByRequest" parameterType="java.lang.String" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
<select id="collectionCountByRequest" parameterType="java.lang.String" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
||||||
SELECT
|
SELECT
|
||||||
test_plan_api_case.test_plan_collection_id AS moduleId,
|
test_plan_api_case.test_plan_collection_id AS moduleId,
|
||||||
|
@ -653,4 +658,6 @@
|
||||||
GROUP BY
|
GROUP BY
|
||||||
test_plan_api_case.test_plan_collection_id
|
test_plan_api_case.test_plan_collection_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -23,6 +23,7 @@ import io.metersphere.system.service.UserLoginService;
|
||||||
import io.metersphere.system.utils.PageUtils;
|
import io.metersphere.system.utils.PageUtils;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
@ -113,6 +114,7 @@ public class TestPlanTaskCenterService {
|
||||||
public List<TaskCenterDTO> getPage(TaskCenterPageRequest request, List<OptionDTO> projectList, boolean isSystem) {
|
public List<TaskCenterDTO> getPage(TaskCenterPageRequest request, List<OptionDTO> projectList, boolean isSystem) {
|
||||||
List<TaskCenterDTO> list = new ArrayList<>();
|
List<TaskCenterDTO> list = new ArrayList<>();
|
||||||
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
||||||
|
if (CollectionUtils.isNotEmpty(projectIds)) {
|
||||||
Map<String, ExecuteReportDTO> historyDeletedMap = new HashMap<>();
|
Map<String, ExecuteReportDTO> historyDeletedMap = new HashMap<>();
|
||||||
list = extTestPlanReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime());
|
list = extTestPlanReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime());
|
||||||
//执行历史列表
|
//执行历史列表
|
||||||
|
@ -122,6 +124,8 @@ public class TestPlanTaskCenterService {
|
||||||
historyDeletedMap = historyDeletedList.stream().collect(Collectors.toMap(ExecuteReportDTO::getId, Function.identity()));
|
historyDeletedMap = historyDeletedList.stream().collect(Collectors.toMap(ExecuteReportDTO::getId, Function.identity()));
|
||||||
}*/
|
}*/
|
||||||
processTaskCenter(list, projectList, projectIds, historyDeletedMap);
|
processTaskCenter(list, projectList, projectIds, historyDeletedMap);
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest {
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setTestPlanId("wxxx_1");
|
request.setTestPlanId("wxxx_1");
|
||||||
request.setProjectId("wxx_1234");
|
request.setProjectId("wxx_1234");
|
||||||
request.setProtocol("HTTP");
|
request.setProtocols(List.of("HTTP"));
|
||||||
this.requestPost(API_CASE_PAGE, request);
|
this.requestPost(API_CASE_PAGE, request);
|
||||||
request.setSort(new HashMap<>() {{
|
request.setSort(new HashMap<>() {{
|
||||||
put("createTime", "desc");
|
put("createTime", "desc");
|
||||||
|
@ -54,7 +54,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest {
|
||||||
TestPlanApiCaseModuleRequest request = new TestPlanApiCaseModuleRequest();
|
TestPlanApiCaseModuleRequest request = new TestPlanApiCaseModuleRequest();
|
||||||
request.setTestPlanId("wxxx_1");
|
request.setTestPlanId("wxxx_1");
|
||||||
request.setProjectId("wxx_1234");
|
request.setProjectId("wxx_1234");
|
||||||
request.setProtocol("HTTP");
|
request.setProtocols(List.of("HTTP"));
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setTreeType("MODULE");
|
request.setTreeType("MODULE");
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
|
@ -54,6 +55,7 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setTestPlanId("wxx_1");
|
request.setTestPlanId("wxx_1");
|
||||||
request.setProjectId("1234567");
|
request.setProjectId("1234567");
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
this.requestPost(API_ASSOCIATION_URL, request);
|
this.requestPost(API_ASSOCIATION_URL, request);
|
||||||
request.setProjectId("wx_1234");
|
request.setProjectId("wx_1234");
|
||||||
this.requestPost(API_ASSOCIATION_URL, request);
|
this.requestPost(API_ASSOCIATION_URL, request);
|
||||||
|
@ -74,6 +76,7 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
request.setProjectId("1234567");
|
request.setProjectId("1234567");
|
||||||
request.setTestPlanId("wxx_1");
|
request.setTestPlanId("wxx_1");
|
||||||
|
request.setProtocols(List.of("HTTP"));
|
||||||
this.requestPost(API_CASE_ASSOCIATION_URL, request);
|
this.requestPost(API_CASE_ASSOCIATION_URL, request);
|
||||||
request.setProjectId("wx_1234");
|
request.setProjectId("wx_1234");
|
||||||
this.requestPost(API_CASE_ASSOCIATION_URL, request);
|
this.requestPost(API_CASE_ASSOCIATION_URL, request);
|
||||||
|
|
|
@ -383,6 +383,13 @@
|
||||||
width: 200,
|
width: 200,
|
||||||
columnSelectorDisabled: true,
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'apiTestManagement.protocol',
|
||||||
|
dataIndex: 'protocol',
|
||||||
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
|
showDrag: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'apiTestManagement.apiType',
|
title: 'apiTestManagement.apiType',
|
||||||
dataIndex: 'method',
|
dataIndex: 'method',
|
||||||
|
@ -494,6 +501,7 @@
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await initFilterColumn();
|
await initFilterColumn();
|
||||||
await tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer', true);
|
await tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer', true);
|
||||||
if (props.readOnly) {
|
if (props.readOnly) {
|
||||||
|
@ -964,12 +972,15 @@
|
||||||
:deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) {
|
:deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) {
|
||||||
&:not(:hover) {
|
&:not(:hover) {
|
||||||
border-color: transparent !important;
|
border-color: transparent !important;
|
||||||
|
|
||||||
.arco-input::placeholder {
|
.arco-input::placeholder {
|
||||||
@apply invisible;
|
@apply invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arco-select-view-icon {
|
.arco-select-view-icon {
|
||||||
@apply invisible;
|
@apply invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arco-select-view-value {
|
.arco-select-view-value {
|
||||||
color: var(--color-text-brand);
|
color: var(--color-text-brand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,6 +400,13 @@
|
||||||
width: 180,
|
width: 180,
|
||||||
columnSelectorDisabled: true,
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'apiTestManagement.protocol',
|
||||||
|
dataIndex: 'protocol',
|
||||||
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
|
showDrag: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'case.caseLevel',
|
title: 'case.caseLevel',
|
||||||
dataIndex: 'priority',
|
dataIndex: 'priority',
|
||||||
|
|
|
@ -286,6 +286,13 @@
|
||||||
width: 200,
|
width: 200,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'apiTestManagement.protocol',
|
||||||
|
dataIndex: 'protocol',
|
||||||
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
|
showDrag: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'mockManagement.apiPath',
|
title: 'mockManagement.apiPath',
|
||||||
dataIndex: 'apiPath',
|
dataIndex: 'apiPath',
|
||||||
|
|
|
@ -173,6 +173,13 @@
|
||||||
width: 200,
|
width: 200,
|
||||||
columnSelectorDisabled: true,
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'apiTestManagement.protocol',
|
||||||
|
dataIndex: 'protocol',
|
||||||
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
|
showDrag: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'apiTestManagement.apiType',
|
title: 'apiTestManagement.apiType',
|
||||||
dataIndex: 'method',
|
dataIndex: 'method',
|
||||||
|
|
|
@ -181,6 +181,13 @@
|
||||||
width: 180,
|
width: 180,
|
||||||
columnSelectorDisabled: true,
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'apiTestManagement.protocol',
|
||||||
|
dataIndex: 'protocol',
|
||||||
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
|
showDrag: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'case.caseLevel',
|
title: 'case.caseLevel',
|
||||||
dataIndex: 'priority',
|
dataIndex: 'priority',
|
||||||
|
|
|
@ -40,6 +40,7 @@ export default {
|
||||||
'apiTestManagement.apiType': 'Method',
|
'apiTestManagement.apiType': 'Method',
|
||||||
'apiTestManagement.apiStatus': 'Status',
|
'apiTestManagement.apiStatus': 'Status',
|
||||||
'apiTestManagement.path': 'Path',
|
'apiTestManagement.path': 'Path',
|
||||||
|
'apiTestManagement.protocol': 'Protocol',
|
||||||
'apiTestManagement.version': 'Version',
|
'apiTestManagement.version': 'Version',
|
||||||
'apiTestManagement.createTime': 'Creation Time',
|
'apiTestManagement.createTime': 'Creation Time',
|
||||||
'apiTestManagement.updateTime': 'Update Time',
|
'apiTestManagement.updateTime': 'Update Time',
|
||||||
|
|
|
@ -39,6 +39,7 @@ export default {
|
||||||
'apiTestManagement.apiType': '请求类型',
|
'apiTestManagement.apiType': '请求类型',
|
||||||
'apiTestManagement.apiStatus': '状态',
|
'apiTestManagement.apiStatus': '状态',
|
||||||
'apiTestManagement.path': '路径',
|
'apiTestManagement.path': '路径',
|
||||||
|
'apiTestManagement.protocol': '协议',
|
||||||
'apiTestManagement.version': '版本',
|
'apiTestManagement.version': '版本',
|
||||||
'apiTestManagement.createTime': '创建时间',
|
'apiTestManagement.createTime': '创建时间',
|
||||||
'apiTestManagement.updateTime': '更新时间',
|
'apiTestManagement.updateTime': '更新时间',
|
||||||
|
|
Loading…
Reference in New Issue