fix: 基础设施-代码生成-整个模块不能使用

This commit is contained in:
gaibu 2023-01-09 13:58:19 +08:00
parent bbb27df5e9
commit df479f627e
2 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.infra.convert.codegen; 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.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.CodegenDetailRespVO;
import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.CodegenPreviewRespVO; import cn.iocoder.yudao.module.infra.controller.admin.codegen.vo.CodegenPreviewRespVO;
@ -33,7 +34,15 @@ public interface CodegenConvert {
}) })
CodegenTableDO convert(TableInfo bean); CodegenTableDO convert(TableInfo bean);
List<CodegenColumnDO> convertList(List<TableField> list); default List<CodegenColumnDO> convertList(List<TableField> 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({ @Mappings({
@Mapping(source = "name", target = "columnName"), @Mapping(source = "name", target = "columnName"),
@ -45,7 +54,7 @@ public interface CodegenConvert {
@Mapping(source = "columnType.type", target = "javaType"), @Mapping(source = "columnType.type", target = "javaType"),
@Mapping(source = "propertyName", target = "javaField"), @Mapping(source = "propertyName", target = "javaField"),
}) })
CodegenColumnDO convert(TableField bean); CodegenColumnDO convert0(TableField bean);
// ========== CodegenTableDO 相关 ========== // ========== CodegenTableDO 相关 ==========

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.codegen.CodegenColumnListConditionEnu
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.generator.config.po.TableField;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -42,6 +43,7 @@ public class CodegenColumnDO extends BaseDO {
private String columnName; private String columnName;
/** /**
* 字段类型 * 字段类型
* 关联 {@link TableField#getColumnType()}}
*/ */
private String dataType; private String dataType;
/** /**