diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/codegen/CodegenConvert.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/codegen/CodegenConvert.java index b0df3e34f..7f33cf543 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/codegen/CodegenConvert.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/codegen/CodegenConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.infra.convert.codegen; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.CodegenDetailRespVO; import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.CodegenPreviewRespVO; @@ -33,7 +34,15 @@ public interface CodegenConvert { }) CodegenTableDO convert(TableInfo bean); - List convertList(List list); + default List convertList(List list){ + return CollUtil.map(list,t->convert(t),true); + } + + default CodegenColumnDO convert(TableField bean) { + CodegenColumnDO codegenColumnDO = convert0(bean); + codegenColumnDO.setDataType(bean.getColumnType().getType()); + return codegenColumnDO; + } @Mappings({ @Mapping(source = "name", target = "columnName"), @@ -45,7 +54,7 @@ public interface CodegenConvert { @Mapping(source = "columnType.type", target = "javaType"), @Mapping(source = "propertyName", target = "javaField"), }) - CodegenColumnDO convert(TableField bean); + CodegenColumnDO convert0(TableField bean); // ========== CodegenTableDO 相关 ========== diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/codegen/CodegenColumnDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/codegen/CodegenColumnDO.java index 4e7f330e5..470b9969c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/codegen/CodegenColumnDO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/codegen/CodegenColumnDO.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.codegen.CodegenColumnListConditionEnu import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.generator.config.po.TableField; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -42,6 +43,7 @@ public class CodegenColumnDO extends BaseDO { private String columnName; /** * 字段类型 + * 关联 {@link TableField#getColumnType()}} */ private String dataType; /**