From 86525f16e1fd4afacf685ec0c5255a08cdc32ed5 Mon Sep 17 00:00:00 2001 From: jerry_zheng Date: Mon, 24 Jul 2023 23:58:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=99=A8=20ColumnConfig=20=E5=A2=9E=E5=8A=A0=20proper?= =?UTF-8?q?tyType.=20=E5=8F=AF=E4=BB=A5=E7=94=A8=E4=BA=8E=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E9=80=9A=E7=94=A8=E5=B1=9E=E6=80=A7=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mybatisflex/codegen/config/ColumnConfig.java | 10 ++++++++++ .../java/com/mybatisflex/codegen/entity/Column.java | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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 04579aae..7be95683 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,6 +60,10 @@ public class ColumnConfig implements Serializable { * 配置的 jdbcType。 */ private JdbcType jdbcType; + /** + * 属性的类型。 + */ + private Class propertyType; /** * 自定义 TypeHandler。 @@ -207,5 +211,11 @@ public class ColumnConfig implements Serializable { public void setTenantId(Boolean tenantId) { this.tenantId = tenantId; } + public Class getPropertyType() { + return propertyType; + } + public void setPropertyType(Class propertyType) { + this.propertyType = propertyType; + } } diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java index 4f2c9cd1..d1efb73f 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/entity/Column.java @@ -93,7 +93,12 @@ public class Column { } public String getPropertySimpleType() { - return propertyType.substring(propertyType.lastIndexOf(".") + 1); + if (columnConfig.getPropertyType()!=null){ + return columnConfig.getPropertyType().getSimpleName(); + } + else { + return propertyType.substring(propertyType.lastIndexOf(".") + 1); + } } public void setPropertyType(String propertyType) { @@ -291,6 +296,9 @@ public class Column { } if (columnConfig != null) { + if (columnConfig.getPropertyType() !=null){ + importClasses.add(columnConfig.getPropertyType().getName()); + } if (columnConfig.getMask() != null) { importClasses.add(ColumnMask.class.getName()); }