refactor(接口测试): 支持场景循环步骤排序

This commit is contained in:
fit2-zhao 2024-03-28 10:47:48 +08:00 committed by Craftsman
parent 203fcaeed6
commit 2157d8670d
4 changed files with 96 additions and 7 deletions

View File

@ -48,6 +48,10 @@ public class ApiScenarioReportDetail implements Serializable {
@Schema(description = "脚本标识")
private String scriptIdentifier;
@Schema(description = "用于循环请求排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_scenario_report_detail.sort.not_blank}", groups = {Created.class})
private Long sort;
@Schema(description = "执行结果")
private byte[] content;
@ -64,6 +68,7 @@ public class ApiScenarioReportDetail implements Serializable {
code("code", "code", "VARCHAR", false),
responseSize("response_size", "responseSize", "BIGINT", false),
scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false),
sort("sort", "sort", "BIGINT", false),
content("content", "content", "LONGVARBINARY", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -783,6 +783,66 @@ public class ApiScenarioReportDetailExample {
addCriterion("script_identifier not between", value1, value2, "scriptIdentifier");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Long value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Long value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Long value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Long value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Long value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Long value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Long> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Long> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Long value1, Long value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Long value1, Long value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -12,6 +12,7 @@
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="response_size" jdbcType="BIGINT" property="responseSize" />
<result column="script_identifier" jdbcType="VARCHAR" property="scriptIdentifier" />
<result column="sort" jdbcType="BIGINT" property="sort" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.api.domain.ApiScenarioReportDetail">
<result column="content" jdbcType="LONGVARBINARY" property="content" />
@ -76,7 +77,7 @@
</sql>
<sql id="Base_Column_List">
id, report_id, step_id, `status`, fake_code, request_name, request_time, code, response_size,
script_identifier
script_identifier, sort
</sql>
<sql id="Blob_Column_List">
content
@ -133,11 +134,13 @@
insert into api_scenario_report_detail (id, report_id, step_id,
`status`, fake_code, request_name,
request_time, code, response_size,
script_identifier, content)
script_identifier, sort, content
)
values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{stepId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{fakeCode,jdbcType=VARCHAR}, #{requestName,jdbcType=VARCHAR},
#{requestTime,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{responseSize,jdbcType=BIGINT},
#{scriptIdentifier,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARBINARY})
#{scriptIdentifier,jdbcType=VARCHAR}, #{sort,jdbcType=BIGINT}, #{content,jdbcType=LONGVARBINARY}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiScenarioReportDetail">
insert into api_scenario_report_detail
@ -172,6 +175,9 @@
<if test="scriptIdentifier != null">
script_identifier,
</if>
<if test="sort != null">
sort,
</if>
<if test="content != null">
content,
</if>
@ -207,6 +213,9 @@
<if test="scriptIdentifier != null">
#{scriptIdentifier,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARBINARY},
</if>
@ -251,6 +260,9 @@
<if test="record.scriptIdentifier != null">
script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=BIGINT},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARBINARY},
</if>
@ -271,6 +283,7 @@
code = #{record.code,jdbcType=VARCHAR},
response_size = #{record.responseSize,jdbcType=BIGINT},
script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -287,7 +300,8 @@
request_time = #{record.requestTime,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
response_size = #{record.responseSize,jdbcType=BIGINT},
script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR}
script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -322,6 +336,9 @@
<if test="scriptIdentifier != null">
script_identifier = #{scriptIdentifier,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=BIGINT},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARBINARY},
</if>
@ -339,6 +356,7 @@
code = #{code,jdbcType=VARCHAR},
response_size = #{responseSize,jdbcType=BIGINT},
script_identifier = #{scriptIdentifier,jdbcType=VARCHAR},
sort = #{sort,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -352,19 +370,20 @@
request_time = #{requestTime,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR},
response_size = #{responseSize,jdbcType=BIGINT},
script_identifier = #{scriptIdentifier,jdbcType=VARCHAR}
script_identifier = #{scriptIdentifier,jdbcType=VARCHAR},
sort = #{sort,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into api_scenario_report_detail
(id, report_id, step_id, `status`, fake_code, request_name, request_time, code, response_size,
script_identifier, content)
script_identifier, sort, content)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.reportId,jdbcType=VARCHAR}, #{item.stepId,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR}, #{item.fakeCode,jdbcType=VARCHAR}, #{item.requestName,jdbcType=VARCHAR},
#{item.requestTime,jdbcType=BIGINT}, #{item.code,jdbcType=VARCHAR}, #{item.responseSize,jdbcType=BIGINT},
#{item.scriptIdentifier,jdbcType=VARCHAR}, #{item.content,jdbcType=LONGVARBINARY}
#{item.scriptIdentifier,jdbcType=VARCHAR}, #{item.sort,jdbcType=BIGINT}, #{item.content,jdbcType=LONGVARBINARY}
)
</foreach>
</insert>
@ -408,6 +427,9 @@
<if test="'script_identifier'.toString() == column.value">
#{item.scriptIdentifier,jdbcType=VARCHAR}
</if>
<if test="'sort'.toString() == column.value">
#{item.sort,jdbcType=BIGINT}
</if>
<if test="'content'.toString() == column.value">
#{item.content,jdbcType=LONGVARBINARY}
</if>

View File

@ -396,6 +396,8 @@ CREATE TABLE IF NOT EXISTS api_scenario_report_detail(
`response_size` BIGINT NOT NULL DEFAULT 0 COMMENT '响应内容大小' ,
`script_identifier` VARCHAR(255) COMMENT '脚本标识' ,
`content` LONGBLOB COMMENT '执行结果' ,
`sort` BIGINT NOT NULL COMMENT '用于循环请求排序' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4