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()); }