From 91e503ba7453d80e2c4864e5b67d2eefa58cd5d2 Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 25 Jul 2023 22:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86ColumnConfig=E7=9A=84propertyType?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BAString=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E5=85=B6=E6=94=AF=E6=8C=81=E5=8E=9F=E5=A7=8B=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20ColumnConfig=E6=B7=BB=E5=8A=A0propertyDefaultValue?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=94=AF=E6=8C=81=E4=B8=BA=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84=E5=AE=9E=E4=BD=93=E7=B1=BB=E7=9A=84=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=80=BC=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AF=B9=E5=BA=94=E6=96=87=E6=A1=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh/others/codegen.md | 13 +++++++++++++ .../mybatisflex/codegen/config/ColumnConfig.java | 9 +++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/zh/others/codegen.md b/docs/zh/others/codegen.md index 5115848e..a222813d 100644 --- a/docs/zh/others/codegen.md +++ b/docs/zh/others/codegen.md @@ -449,9 +449,22 @@ public class ColumnConfig implements Serializable { // 是否是租户列 private Boolean tenantId; + + /** + * 属性的类型。 + * 原始类型直接写类型名称,例:int/long/float/double/boolean + * 对象类型请写对应类的全限定名,例:java.lang.String/com.abc.def.enums.Gender + */ + private String propertyType; + + /** + * 属性的默认值, 例:long类型默认值:0L,枚举类型默认值:Gender.MALE + */ + private String propertyDefaultValue; } ``` + ## 自定义属性类型 MyBatis-Flex 内置了一个名为:`JdbcTypeMapping` 的 java 类,我们可以用其配置映射 Jdbc 驱动的数据类型为自定义的 diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ColumnConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ColumnConfig.java index 7bb50eee..2352fc86 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ColumnConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ColumnConfig.java @@ -60,8 +60,9 @@ public class ColumnConfig implements Serializable { * 配置的 jdbcType。 */ private JdbcType jdbcType; + /** - * 属性的类型。原始类型直接写类型名称:int/long/float/double/boolean,对象类型请写对应类的全限定名: + * 属性的类型。 */ private String propertyType; @@ -216,14 +217,14 @@ public class ColumnConfig implements Serializable { public void setTenantId(Boolean tenantId) { this.tenantId = tenantId; } - public Class getPropertyType() { - return propertyType; - } public String getPropertyType() { return propertyType; } + /** + * 原始类型直接写类型名称,例:int/long/float/double/boolean,对象类型请写对应类的全限定名,例:java.lang.String + */ public void setPropertyType(String propertyType) { this.propertyType = propertyType; }