-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
849 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportDetailBlob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
Oops, something went wrong.