Skip to content

Commit

Permalink
refactor(接口测试): 优化报告存储结构
Browse files Browse the repository at this point in the history
  • Loading branch information
fit2-zhao committed May 24, 2024
1 parent 4923c6d commit 16434c4
Show file tree
Hide file tree
Showing 13 changed files with 849 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public class ApiScenarioReportDetail implements Serializable {
@NotNull(message = "{api_scenario_report_detail.sort.not_blank}", groups = {Created.class})
private Long sort;

@Schema(description = "执行结果")
private byte[] content;

private static final long serialVersionUID = 1L;

public enum Column {
Expand All @@ -68,8 +65,7 @@ public enum Column {
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);
sort("sort", "sort", "BIGINT", false);

private static final String BEGINNING_DELIMITER = "`";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package io.metersphere.api.domain;

import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.Data;

@Data
public class ApiScenarioReportDetailBlob implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_scenario_report_detail_blob.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{api_scenario_report_detail_blob.id.length_range}", groups = {Created.class, Updated.class})
private String id;

@Schema(description = "报告fk", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_scenario_report_detail_blob.report_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{api_scenario_report_detail_blob.report_id.length_range}", groups = {Created.class, Updated.class})
private String reportId;

@Schema(description = "执行结果")
private byte[] content;

private static final long serialVersionUID = 1L;

public enum Column {
id("id", "id", "VARCHAR", false),
reportId("report_id", "reportId", "VARCHAR", false),
content("content", "content", "LONGVARBINARY", false);

private static final String BEGINNING_DELIMITER = "`";

private static final String ENDING_DELIMITER = "`";

private final String column;

private final boolean isColumnNameDelimited;

private final String javaProperty;

private final String jdbcType;

public String value() {
return this.column;
}

public String getValue() {
return this.column;
}

public String getJavaProperty() {
return this.javaProperty;
}

public String getJdbcType() {
return this.jdbcType;
}

Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}

public String desc() {
return this.getEscapedColumnName() + " DESC";
}

public String asc() {
return this.getEscapedColumnName() + " ASC";
}

public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}

public static Column[] all() {
return Column.values();
}

public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}

public String getAliasedEscapedColumnName() {
return this.getEscapedColumnName();
}
}
}
Loading

0 comments on commit 16434c4

Please sign in to comment.