fix: 基础设施-代码生成-整个模块不能使用
This commit is contained in:
parent
df479f627e
commit
431c029b60
|
@ -1,6 +1,5 @@
|
|||
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;
|
||||
|
@ -12,9 +11,11 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenColumnDO;
|
|||
import cn.iocoder.yudao.module.infra.dal.dataobject.codegen.CodegenTableDO;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableField;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -34,19 +35,11 @@ public interface CodegenConvert {
|
|||
})
|
||||
CodegenTableDO convert(TableInfo bean);
|
||||
|
||||
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;
|
||||
}
|
||||
List<CodegenColumnDO> convertList(List<TableField> list);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "name", target = "columnName"),
|
||||
@Mapping(source = "type", target = "dataType"),
|
||||
@Mapping(source = "columnType", target = "dataType", qualifiedByName = "getType"),
|
||||
@Mapping(source = "comment", target = "columnComment"),
|
||||
@Mapping(source = "metaInfo.nullable", target = "nullable"),
|
||||
@Mapping(source = "keyFlag", target = "primaryKey"),
|
||||
|
@ -54,7 +47,12 @@ public interface CodegenConvert {
|
|||
@Mapping(source = "columnType.type", target = "javaType"),
|
||||
@Mapping(source = "propertyName", target = "javaField"),
|
||||
})
|
||||
CodegenColumnDO convert0(TableField bean);
|
||||
CodegenColumnDO convert(TableField bean);
|
||||
|
||||
@Named("getType")
|
||||
default String getType(IColumnType jdbcType) {
|
||||
return jdbcType.getType();
|
||||
}
|
||||
|
||||
// ========== CodegenTableDO 相关 ==========
|
||||
|
||||
|
|
Loading…
Reference in New Issue