java mybatisplus generator 修改字段类型

最新版生成代码的指定字段类型
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();
})

你可能感兴趣的:(java,python,前端)