feat: 支持字段最大长度设置
This commit is contained in:
@@ -40,7 +40,7 @@ public class GenFieldConfig extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 字段长度
|
* 字段长度
|
||||||
*/
|
*/
|
||||||
private String columnLength;
|
private Integer maxLength;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段名称
|
* 字段名称
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ public class GenConfigForm {
|
|||||||
@Schema(description = "是否必填")
|
@Schema(description = "是否必填")
|
||||||
private Integer isRequired;
|
private Integer isRequired;
|
||||||
|
|
||||||
|
@Schema(description = "最大长度")
|
||||||
|
private Integer maxLength;
|
||||||
|
|
||||||
@Schema(description = "表单类型")
|
@Schema(description = "表单类型")
|
||||||
private FormTypeEnum formType;
|
private FormTypeEnum formType;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class ${entityName}Form implements Serializable {
|
|||||||
#if($fieldConfigs)
|
#if($fieldConfigs)
|
||||||
#foreach($fieldConfig in ${fieldConfigs})
|
#foreach($fieldConfig in ${fieldConfigs})
|
||||||
#if($fieldConfig.isShowInForm)
|
#if($fieldConfig.isShowInForm)
|
||||||
|
#if("$!fieldConfig.fieldComment" != "")
|
||||||
|
@Schema(description = "${fieldConfig.fieldComment}")
|
||||||
|
#end
|
||||||
#if($fieldConfig.isRequired)
|
#if($fieldConfig.isRequired)
|
||||||
#if($fieldConfig.fieldType == 'String')
|
#if($fieldConfig.fieldType == 'String')
|
||||||
@NotBlank(message = "$fieldConfig.fieldComment不能为空")
|
@NotBlank(message = "$fieldConfig.fieldComment不能为空")
|
||||||
@@ -40,10 +43,11 @@ public class ${entityName}Form implements Serializable {
|
|||||||
@NotNull(message = "$fieldConfig.fieldComment不能为空")
|
@NotNull(message = "$fieldConfig.fieldComment不能为空")
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if("$!fieldConfig.fieldComment" != "")
|
#if($fieldConfig.maxLength)
|
||||||
@Schema(description = "${fieldConfig.fieldComment}")
|
@Size(max=$fieldConfig.maxLength, message="$fieldConfig.fieldComment长度不能超过${fieldConfig.maxLength}个字符")
|
||||||
#end
|
#end
|
||||||
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
private ${fieldConfig.fieldType} ${fieldConfig.fieldName};
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|||||||
Reference in New Issue
Block a user