Skip to content

Commit

Permalink
perf: 优化插入MySQL时脚本参数过长的报错信息,使用validation校验脚本长度 TencentBlueKing#3374
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyzh39 committed Jan 20, 2025
1 parent cc0b0de commit b9c1459
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand All @@ -53,6 +54,10 @@

String message() default "{fieldName} {validation.constraints.NotExceedMySQLFieldLength.message}";

Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};

String fieldName();

MySQLDataType fieldType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public class EsbFastExecuteScriptRequest extends EsbAppScopeReq {
* 脚本参数, BASE64编码
*/
@JsonProperty("script_param")
@NotExceedMySQLFieldLength(
fieldName = "scriptParam",
fieldType = MySQLDataType.TEXT
)
private String scriptParam;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public class EsbFastExecuteScriptV3Request extends EsbAppScopeReq {
* 脚本参数, BASE64编码
*/
@JsonProperty("script_param")
@NotExceedMySQLFieldLength(
fieldName = "scriptParam",
fieldType = MySQLDataType.TEXT
)
private String scriptParam;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public class WebFastExecuteScriptRequest {
* 脚本参数
*/
@ApiModelProperty(value = "脚本参数")
@NotExceedMySQLFieldLength(
fieldName = "scriptParam",
fieldType = MySQLDataType.TEXT
)
private String scriptParam;

/**
Expand Down

0 comments on commit b9c1459

Please sign in to comment.