最新版生成代码的指定字段类型
java
FastAutoGenerator
.dataSourceConfig(config -> {
config.typeConvertHandler(new ITypeConvertHandler() {
@Override
public @NotNull IColumnType convert(GlobalConfig globalConfig, TypeRegistry typeRegistry, TableField.MetaInfo metaInfo) {
if ("status".equals(metaInfo.getColumnName())){
return new IColumnType() {
@Override
public String getType() {
return StatusEnum.getSimpleName();
}
@Override
public String getPkg() {
return StatusEnum.getName();
}
};
}
return typeRegistry.getColumnType(metaInfo);
}
})
.build();
})