Type Meta Annotation
用于为特定字段类型声明补充信息,例如字符串长度限制、数字精度、附件允许格式等。
@TextMeta - Text, MultiText, RichText
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| length | Int | 256 | 字符串长度 |
| rule | String | / | Text 类型规则字段 |
👀 规则字段文档

@NumberMeta - Int,Float
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| unit | String | / | 数值展示的单位,例如 % 、天等等 |
| format | String | / | 格式化表达式 |
@IntDigits - Int,Float
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| value | int | 7 | 整数位数 |
@DecimalDigits - Float
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| value | int | 2 | 小数位数 |

@BooleanMeta - Boolean
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| trueLabel | String | 是 | 当值为 true 时的前端显示标签 |
| falseLabel | String | 否 | 当值为 false 时的前端显示标签 |

@EnumMeta - Enum
模块中必须有枚举类才能配置此注解。
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| labels | NamedLabel[] | {} | 当值为 true 时的前端显示标签 |
| values | String[] | {} | 显示枚举, 若不配置 则默认显示全部labels选项。 若配置 则只显示配置的枚举name |
| excludes | String[] | {} | 排除枚举name |

@DictionaryMeta - Dictionary
模块中必须有字典才能配置此注解。
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| clazz | Class | / | 字典值来源类,不同字典值的展示信息通过在字典类中的值上注解 @Label 来实现 |
| dictionaryType | TDictType | TDictType.String | 字典类型 |
字典分为String和Int类型,如果模块中没有对应类型的字典,不能配置此注解。如下图,当字典类型选Int时,@DictionaryMeta面板将不显示。

@DateTimeMeta - DateTime
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| unit | TimeUnit | TimeUnit.MINUTES | 字典值来源类,不同字典值的展示信息通过在字典类中的值上注解 @Label 来实现 |
| format | String | / | 格式化表达式,用于前端展示格式所用。 需要注意这里目前使用的并不是 Java 的 SimpleDateFormat 的格式,而是前端采用的 moment 的 format 格式。 参考 https://momentjs.com/ |

@TimeMeta - Time
与@DateTimeMeta类似
@ImageMeta - Image
图片url
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| maxSize | int | Integer.MAX_VALUE | 文件最大允许大小,单位 KB ,默认 Integer.MAX_VALUE ,大约 2T |
| readPolicy | ReadPolicy | / | 附件的读取策略, 默认为私有读 |
maxSize支持写数学表达式,参考 ⬇️ 图

@RelationMeta - ToOne, ToMany
关联关系
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| name | String | / | 必填,关系名称,用于惟一标识一个模型间关系; |
| modelClass | Class | RootModel.class | 关联模型 class |
| onDelete | OnDeleteType | OnDeleteType.SET_NULL | 关联字段更新策略, 默认只解除关系,不级联删除 |
| relationTableName | String | / | 关联表名,仅适用与 ManyToMany |
| opposite | RelationType | RelationType.AUTO | 反向关系,默认自动生成,也可以强制指定反向关系 |
| oppositeColumnName | String | / | 反向关系字段名,适用于 ManyToMany |
| side | RelationSide | RelationSide.AUTO | 关系字段在哪张表中,仅适用于 OneToOne 关系 |

@AttachmentMeta - Attachment
附件
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| showType | ShowType | ShowType.ALL | 展示类型, 默认不限制 |
| allowedTypes | String[] | {} | 允许的文件类型,后缀名,不区分大小写,留空则为不限制,默认不限制 。 |
| maxSize | int | Integer.MAX_VALUE | 单文件最大允许大小,单位 KB ,默认 Integer.MAX_VALUE ,大约 2T |
| countLimit | int | 1 | 允许上传文件数量 |
| readPolicy | ReadPolicy | ReadPolicy.PRIVATE | 附件的读取策略, 默认为私有读 |

@AddressMeta - Address
地址
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| containsDetail | boolean | true | 是否包含详细地址 |
| containsPostcode | boolean | true | 是否包含邮政编码 |

@Reference
冗余字段注解,可以在模型中冗余关联模型的字段。只能冗余 ToOne 关系模型中的字段。
| AtrributeName | Type | Default | Explain |
|---|---|---|---|
| fromField | String | / | 关联的 ToOne 字段名 |
| mappingField | String | / | 关联到的模型内字段名 |
| onChange | Refresh | Refresh.NEVER | 数据同步策略,默认同步策略为 NEVER ,即只在该条记录创建时填充一次冗余字段。 如果希望总是获得最新的数据,可将同步策略改为 SYNC ,但使用 SYNC 需要特别小心,可能导致很大数据量的冗余字段更新 。 |
可设置冗余字段的字段类型:
- Text
- MultiText
- RichText
- Int
- Boolean
- Image
