diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetail.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetail.java index e6c5516061..342850fc74 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetail.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetail.java @@ -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 = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetailExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetailExample.java index 8d54c942d8..1e501977c8 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetailExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetailExample.java @@ -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 values) { + addCriterion("sort in", values, "sort"); + return (Criteria) this; + } + + public Criteria andSortNotIn(List 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 { diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportDetailMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportDetailMapper.xml index 3ab1173be2..27d9ca2d9c 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportDetailMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportDetailMapper.xml @@ -12,6 +12,7 @@ + @@ -76,7 +77,7 @@ id, report_id, step_id, `status`, fake_code, request_name, request_time, code, response_size, - script_identifier + script_identifier, sort 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 into api_scenario_report_detail @@ -172,6 +175,9 @@ script_identifier, + + sort, + content, @@ -207,6 +213,9 @@ #{scriptIdentifier,jdbcType=VARCHAR}, + + #{sort,jdbcType=BIGINT}, + #{content,jdbcType=LONGVARBINARY}, @@ -251,6 +260,9 @@ script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR}, + + sort = #{record.sort,jdbcType=BIGINT}, + content = #{record.content,jdbcType=LONGVARBINARY}, @@ -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} @@ -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} @@ -322,6 +336,9 @@ script_identifier = #{scriptIdentifier,jdbcType=VARCHAR}, + + sort = #{sort,jdbcType=BIGINT}, + content = #{content,jdbcType=LONGVARBINARY}, @@ -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} @@ -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} 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 (#{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} ) @@ -408,6 +427,9 @@ #{item.scriptIdentifier,jdbcType=VARCHAR} + + #{item.sort,jdbcType=BIGINT} + #{item.content,jdbcType=LONGVARBINARY} diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql index a719afcb0a..47ad1f5baa 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_5__api_test.sql @@ -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