fix(接口测试): 步骤记录跨项目ID

This commit is contained in:
AgAngle 2024-04-01 17:11:35 +08:00 committed by 刘瑞斌
parent 7b131c3361
commit 86db45c9a0
5 changed files with 104 additions and 8 deletions

View File

@ -54,6 +54,9 @@ public class ApiScenarioStep implements Serializable {
@Schema(description = "循环等组件基础数据")
private String config;
@Schema(description = "记录跨项目复制的步骤的原项目ID")
private String originProjectId;
private static final long serialVersionUID = 1L;
public enum Column {
@ -69,7 +72,8 @@ public class ApiScenarioStep implements Serializable {
parentId("parent_id", "parentId", "VARCHAR", false),
versionId("version_id", "versionId", "VARCHAR", false),
refType("ref_type", "refType", "VARCHAR", false),
config("config", "config", "VARCHAR", false);
config("config", "config", "VARCHAR", false),
originProjectId("origin_project_id", "originProjectId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -993,6 +993,76 @@ public class ApiScenarioStepExample {
addCriterion("config not between", value1, value2, "config");
return (Criteria) this;
}
public Criteria andOriginProjectIdIsNull() {
addCriterion("origin_project_id is null");
return (Criteria) this;
}
public Criteria andOriginProjectIdIsNotNull() {
addCriterion("origin_project_id is not null");
return (Criteria) this;
}
public Criteria andOriginProjectIdEqualTo(String value) {
addCriterion("origin_project_id =", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdNotEqualTo(String value) {
addCriterion("origin_project_id <>", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdGreaterThan(String value) {
addCriterion("origin_project_id >", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("origin_project_id >=", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdLessThan(String value) {
addCriterion("origin_project_id <", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdLessThanOrEqualTo(String value) {
addCriterion("origin_project_id <=", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdLike(String value) {
addCriterion("origin_project_id like", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdNotLike(String value) {
addCriterion("origin_project_id not like", value, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdIn(List<String> values) {
addCriterion("origin_project_id in", values, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdNotIn(List<String> values) {
addCriterion("origin_project_id not in", values, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdBetween(String value1, String value2) {
addCriterion("origin_project_id between", value1, value2, "originProjectId");
return (Criteria) this;
}
public Criteria andOriginProjectIdNotBetween(String value1, String value2) {
addCriterion("origin_project_id not between", value1, value2, "originProjectId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -15,6 +15,7 @@
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_type" jdbcType="VARCHAR" property="refType" />
<result column="config" jdbcType="VARCHAR" property="config" />
<result column="origin_project_id" jdbcType="VARCHAR" property="originProjectId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -76,7 +77,7 @@
</sql>
<sql id="Base_Column_List">
id, scenario_id, `name`, sort, `enable`, resource_id, resource_num, step_type, project_id,
parent_id, version_id, ref_type, config
parent_id, version_id, ref_type, config, origin_project_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.api.domain.ApiScenarioStepExample" resultMap="BaseResultMap">
select
@ -113,12 +114,12 @@
sort, `enable`, resource_id,
resource_num, step_type, project_id,
parent_id, version_id, ref_type,
config)
config, origin_project_id)
values (#{id,jdbcType=VARCHAR}, #{scenarioId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{sort,jdbcType=BIGINT}, #{enable,jdbcType=BIT}, #{resourceId,jdbcType=VARCHAR},
#{resourceNum,jdbcType=VARCHAR}, #{stepType,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{parentId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{refType,jdbcType=VARCHAR},
#{config,jdbcType=VARCHAR})
#{config,jdbcType=VARCHAR}, #{originProjectId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiScenarioStep">
insert into api_scenario_step
@ -162,6 +163,9 @@
<if test="config != null">
config,
</if>
<if test="originProjectId != null">
origin_project_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -203,6 +207,9 @@
<if test="config != null">
#{config,jdbcType=VARCHAR},
</if>
<if test="originProjectId != null">
#{originProjectId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.api.domain.ApiScenarioStepExample" resultType="java.lang.Long">
@ -253,6 +260,9 @@
<if test="record.config != null">
config = #{record.config,jdbcType=VARCHAR},
</if>
<if test="record.originProjectId != null">
origin_project_id = #{record.originProjectId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -272,7 +282,8 @@
parent_id = #{record.parentId,jdbcType=VARCHAR},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_type = #{record.refType,jdbcType=VARCHAR},
config = #{record.config,jdbcType=VARCHAR}
config = #{record.config,jdbcType=VARCHAR},
origin_project_id = #{record.originProjectId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -316,6 +327,9 @@
<if test="config != null">
config = #{config,jdbcType=VARCHAR},
</if>
<if test="originProjectId != null">
origin_project_id = #{originProjectId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -332,20 +346,21 @@
parent_id = #{parentId,jdbcType=VARCHAR},
version_id = #{versionId,jdbcType=VARCHAR},
ref_type = #{refType,jdbcType=VARCHAR},
config = #{config,jdbcType=VARCHAR}
config = #{config,jdbcType=VARCHAR},
origin_project_id = #{originProjectId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into api_scenario_step
(id, scenario_id, `name`, sort, `enable`, resource_id, resource_num, step_type, project_id,
parent_id, version_id, ref_type, config)
parent_id, version_id, ref_type, config, origin_project_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.scenarioId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
#{item.sort,jdbcType=BIGINT}, #{item.enable,jdbcType=BIT}, #{item.resourceId,jdbcType=VARCHAR},
#{item.resourceNum,jdbcType=VARCHAR}, #{item.stepType,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR},
#{item.parentId,jdbcType=VARCHAR}, #{item.versionId,jdbcType=VARCHAR}, #{item.refType,jdbcType=VARCHAR},
#{item.config,jdbcType=VARCHAR})
#{item.config,jdbcType=VARCHAR}, #{item.originProjectId,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -397,6 +412,9 @@
<if test="'config'.toString() == column.value">
#{item.config,jdbcType=VARCHAR}
</if>
<if test="'origin_project_id'.toString() == column.value">
#{item.originProjectId,jdbcType=VARCHAR}
</if>
</foreach>
)
</foreach>

View File

@ -280,6 +280,7 @@ CREATE TABLE IF NOT EXISTS api_scenario_step(
`parent_id` VARCHAR(50) DEFAULT 'NONE' COMMENT '父级fk' ,
`version_id` VARCHAR(50) COMMENT '版本号' ,
`ref_type` VARCHAR(20) COMMENT '引用/复制/自定义' ,
`origin_project_id` VARCHAR(50) COMMENT '记录跨项目复制的步骤的原项目ID' ,
`config` VARCHAR(500) COMMENT '循环等组件基础数据' ,
PRIMARY KEY (id)
) ENGINE = InnoDB

View File

@ -31,6 +31,9 @@ public class ApiScenarioStepCommonDTO<T extends ApiScenarioStepCommonDTO> {
@Schema(description = "资源id")
private String resourceId;
@Schema(description = "记录跨项目复制的步骤的原项目ID")
private String originProjectId;
/**
* @see ApiScenarioStepType
*/