From df479f627e45b513de169e8f8b747689a7edb6c0 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Mon, 9 Jan 2023 13:58:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD-?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90-=E6=95=B4=E4=B8=AA?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/convert/codegen/CodegenConvert.java | 13 +++++++++++-- .../dal/dataobject/codegen/CodegenColumnDO.java | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) 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; /**