Skip to content

Commit 8af78d9

Browse files
committed
修复强制生成字段注解的配置无法生效的问题
1 parent 287e658 commit 8af78d9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/MbpGeneratorService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ private void genCode(AutoGenerator ag, GenSetting genSetting, UserConfig userCon
131131
focList.add(new FileOutConfig(outputFileInfo.getAvailableTemplatePath()) {
132132
@Override
133133
public String outputFile(TableInfo tableInfo) {
134+
//避免使用了NameConverter导致entityTableFieldAnnotationEnable属性失效的问题,在此强制进行设置
135+
if (userConfig.getEntityStrategy().isEntityTableFieldAnnotationEnable()) {
136+
tableInfo.getFields().forEach(field -> {
137+
field.setConvert(true);
138+
});
139+
tableInfo.getImportPackages().add("com.baomidou.mybatisplus.annotation.TableField");
140+
}
134141
return filePath;
135142
}
136143
});

0 commit comments

Comments
 (0)