|
@@ -11,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;
|
|
@@ -37,7 +39,7 @@ public interface CodegenConvert {
|
|
|
|
|
|
@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"),
|
|
@@ -47,6 +49,11 @@ public interface CodegenConvert {
|
|
|
})
|
|
|
CodegenColumnDO convert(TableField bean);
|
|
|
|
|
|
+ @Named("getType")
|
|
|
+ default String getType(IColumnType jdbcType) {
|
|
|
+ return jdbcType.getType();
|
|
|
+ }
|
|
|
+
|
|
|
// ========== CodegenTableDO 相关 ==========
|
|
|
|
|
|
// List<CodegenTableRespVO> convertList02(List<CodegenTableDO> list);
|