refactor(接口测试): 用例结果表调整

This commit is contained in:
fit2-zhao 2024-01-02 18:19:27 +08:00 committed by Craftsman
parent 6493eecfa7
commit 29fb6dd00e
5 changed files with 109 additions and 31 deletions

View File

@ -15,12 +15,12 @@ public class ApiReportBlob implements Serializable {
@Size(min = 1, max = 50, message = "{api_report_blob.id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{api_report_blob.id.length_range}", groups = {Created.class, Updated.class})
private String id; private String id;
@Schema(description = "执行环境配置")
private String environmentId;
@Schema(description = "结果内容详情") @Schema(description = "结果内容详情")
private byte[] content; private byte[] content;
@Schema(description = "执行环境配置")
private byte[] config;
@Schema(description = "执行过程日志") @Schema(description = "执行过程日志")
private byte[] console; private byte[] console;
@ -28,8 +28,8 @@ public class ApiReportBlob implements Serializable {
public enum Column { public enum Column {
id("id", "id", "VARCHAR", false), id("id", "id", "VARCHAR", false),
environmentId("environment_id", "environmentId", "VARCHAR", false),
content("content", "content", "LONGVARBINARY", false), content("content", "content", "LONGVARBINARY", false),
config("config", "config", "LONGVARBINARY", false),
console("console", "console", "LONGVARBINARY", false); console("console", "console", "LONGVARBINARY", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -173,6 +173,76 @@ public class ApiReportBlobExample {
addCriterion("id not between", value1, value2, "id"); addCriterion("id not between", value1, value2, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEnvironmentIdIsNull() {
addCriterion("environment_id is null");
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNotNull() {
addCriterion("environment_id is not null");
return (Criteria) this;
}
public Criteria andEnvironmentIdEqualTo(String value) {
addCriterion("environment_id =", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotEqualTo(String value) {
addCriterion("environment_id <>", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThan(String value) {
addCriterion("environment_id >", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThanOrEqualTo(String value) {
addCriterion("environment_id >=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThan(String value) {
addCriterion("environment_id <", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThanOrEqualTo(String value) {
addCriterion("environment_id <=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLike(String value) {
addCriterion("environment_id like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotLike(String value) {
addCriterion("environment_id not like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdIn(List<String> values) {
addCriterion("environment_id in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotIn(List<String> values) {
addCriterion("environment_id not in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdBetween(String value1, String value2) {
addCriterion("environment_id between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotBetween(String value1, String value2) {
addCriterion("environment_id not between", value1, value2, "environmentId");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -32,6 +32,8 @@ public interface ApiReportBlobMapper {
int updateByPrimaryKeyWithBLOBs(ApiReportBlob record); int updateByPrimaryKeyWithBLOBs(ApiReportBlob record);
int updateByPrimaryKey(ApiReportBlob record);
int batchInsert(@Param("list") List<ApiReportBlob> list); int batchInsert(@Param("list") List<ApiReportBlob> list);
int batchInsertSelective(@Param("list") List<ApiReportBlob> list, @Param("selective") ApiReportBlob.Column ... selective); int batchInsertSelective(@Param("list") List<ApiReportBlob> list, @Param("selective") ApiReportBlob.Column ... selective);

View File

@ -3,10 +3,10 @@
<mapper namespace="io.metersphere.api.mapper.ApiReportBlobMapper"> <mapper namespace="io.metersphere.api.mapper.ApiReportBlobMapper">
<resultMap id="BaseResultMap" type="io.metersphere.api.domain.ApiReportBlob"> <resultMap id="BaseResultMap" type="io.metersphere.api.domain.ApiReportBlob">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.api.domain.ApiReportBlob"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.api.domain.ApiReportBlob">
<result column="content" jdbcType="LONGVARBINARY" property="content" /> <result column="content" jdbcType="LONGVARBINARY" property="content" />
<result column="config" jdbcType="LONGVARBINARY" property="config" />
<result column="console" jdbcType="LONGVARBINARY" property="console" /> <result column="console" jdbcType="LONGVARBINARY" property="console" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
@ -68,10 +68,10 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id id, environment_id
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content, config, console content, console
</sql> </sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.api.domain.ApiReportBlobExample" resultMap="ResultMapWithBLOBs"> <select id="selectByExampleWithBLOBs" parameterType="io.metersphere.api.domain.ApiReportBlobExample" resultMap="ResultMapWithBLOBs">
select select
@ -122,9 +122,9 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.api.domain.ApiReportBlob"> <insert id="insert" parameterType="io.metersphere.api.domain.ApiReportBlob">
insert into api_report_blob (id, content, config, insert into api_report_blob (id, environment_id, content,
console) console)
values (#{id,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARBINARY}, #{config,jdbcType=LONGVARBINARY}, values (#{id,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARBINARY},
#{console,jdbcType=LONGVARBINARY}) #{console,jdbcType=LONGVARBINARY})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiReportBlob"> <insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiReportBlob">
@ -133,12 +133,12 @@
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="environmentId != null">
environment_id,
</if>
<if test="content != null"> <if test="content != null">
content, content,
</if> </if>
<if test="config != null">
config,
</if>
<if test="console != null"> <if test="console != null">
console, console,
</if> </if>
@ -147,12 +147,12 @@
<if test="id != null"> <if test="id != null">
#{id,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR},
</if> </if>
<if test="environmentId != null">
#{environmentId,jdbcType=VARCHAR},
</if>
<if test="content != null"> <if test="content != null">
#{content,jdbcType=LONGVARBINARY}, #{content,jdbcType=LONGVARBINARY},
</if> </if>
<if test="config != null">
#{config,jdbcType=LONGVARBINARY},
</if>
<if test="console != null"> <if test="console != null">
#{console,jdbcType=LONGVARBINARY}, #{console,jdbcType=LONGVARBINARY},
</if> </if>
@ -170,12 +170,12 @@
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR}, id = #{record.id,jdbcType=VARCHAR},
</if> </if>
<if test="record.environmentId != null">
environment_id = #{record.environmentId,jdbcType=VARCHAR},
</if>
<if test="record.content != null"> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARBINARY}, content = #{record.content,jdbcType=LONGVARBINARY},
</if> </if>
<if test="record.config != null">
config = #{record.config,jdbcType=LONGVARBINARY},
</if>
<if test="record.console != null"> <if test="record.console != null">
console = #{record.console,jdbcType=LONGVARBINARY}, console = #{record.console,jdbcType=LONGVARBINARY},
</if> </if>
@ -187,8 +187,8 @@
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update api_report_blob update api_report_blob
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARBINARY}, content = #{record.content,jdbcType=LONGVARBINARY},
config = #{record.config,jdbcType=LONGVARBINARY},
console = #{record.console,jdbcType=LONGVARBINARY} console = #{record.console,jdbcType=LONGVARBINARY}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -196,7 +196,8 @@
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update api_report_blob update api_report_blob
set id = #{record.id,jdbcType=VARCHAR} set id = #{record.id,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -204,12 +205,12 @@
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.api.domain.ApiReportBlob"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.api.domain.ApiReportBlob">
update api_report_blob update api_report_blob
<set> <set>
<if test="environmentId != null">
environment_id = #{environmentId,jdbcType=VARCHAR},
</if>
<if test="content != null"> <if test="content != null">
content = #{content,jdbcType=LONGVARBINARY}, content = #{content,jdbcType=LONGVARBINARY},
</if> </if>
<if test="config != null">
config = #{config,jdbcType=LONGVARBINARY},
</if>
<if test="console != null"> <if test="console != null">
console = #{console,jdbcType=LONGVARBINARY}, console = #{console,jdbcType=LONGVARBINARY},
</if> </if>
@ -218,17 +219,22 @@
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.api.domain.ApiReportBlob"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.api.domain.ApiReportBlob">
update api_report_blob update api_report_blob
set content = #{content,jdbcType=LONGVARBINARY}, set environment_id = #{environmentId,jdbcType=VARCHAR},
config = #{config,jdbcType=LONGVARBINARY}, content = #{content,jdbcType=LONGVARBINARY},
console = #{console,jdbcType=LONGVARBINARY} console = #{console,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.api.domain.ApiReportBlob">
update api_report_blob
set environment_id = #{environmentId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into api_report_blob insert into api_report_blob
(id, content, config, console) (id, environment_id, content, console)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.content,jdbcType=LONGVARBINARY}, #{item.config,jdbcType=LONGVARBINARY}, (#{item.id,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.content,jdbcType=LONGVARBINARY},
#{item.console,jdbcType=LONGVARBINARY}) #{item.console,jdbcType=LONGVARBINARY})
</foreach> </foreach>
</insert> </insert>
@ -245,12 +251,12 @@
<if test="'id'.toString() == column.value"> <if test="'id'.toString() == column.value">
#{item.id,jdbcType=VARCHAR} #{item.id,jdbcType=VARCHAR}
</if> </if>
<if test="'environment_id'.toString() == column.value">
#{item.environmentId,jdbcType=VARCHAR}
</if>
<if test="'content'.toString() == column.value"> <if test="'content'.toString() == column.value">
#{item.content,jdbcType=LONGVARBINARY} #{item.content,jdbcType=LONGVARBINARY}
</if> </if>
<if test="'config'.toString() == column.value">
#{item.config,jdbcType=LONGVARBINARY}
</if>
<if test="'console'.toString() == column.value"> <if test="'console'.toString() == column.value">
#{item.console,jdbcType=LONGVARBINARY} #{item.console,jdbcType=LONGVARBINARY}
</if> </if>

View File

@ -450,7 +450,7 @@ CREATE TABLE IF NOT EXISTS api_definition_blob(
CREATE TABLE IF NOT EXISTS api_report_blob( CREATE TABLE IF NOT EXISTS api_report_blob(
`id` VARCHAR(50) NOT NULL COMMENT '接口报告fk' , `id` VARCHAR(50) NOT NULL COMMENT '接口报告fk' ,
`content` LONGBLOB COMMENT '结果内容详情' , `content` LONGBLOB COMMENT '结果内容详情' ,
`config` BLOB COMMENT '执行环境配置' , `environment_id` VARCHAR(50) COMMENT '执行环境配置' ,
`console` BLOB COMMENT '执行过程日志' , `console` BLOB COMMENT '执行过程日志' ,
PRIMARY KEY (id) PRIMARY KEY (id)
) ENGINE = InnoDB ) ENGINE = InnoDB