当前使用版本(必填,否则不予处理)
3.5.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
重现步骤(如果有就写完整)
globalConfig设置了fileOverride,策略是覆盖生成文件。 希望设置策略,当要生成的文件已经存在时,则不继续生成该文件
报错信息
Comment From: qmdx
https://www.bilibili.com/video/BV1db4y1a7ew 看下视频教程模板配置,注入配置
Comment From: lrbmike
目前我的处理方法是重写模板引擎的outputFile方法 ` xxxx.templateEngine(new FreemarkerTemplateEngine(){// 使用Freemarker引擎模板,默认的是Velocity引擎模板
@Override
protected void outputFile(File file, Map<String, Object> objectMap, String templatePath) {
//判断文件是否存在
boolean exist = file.exists();
if (exist) {//文件存在
if (templatePath.indexOf("entity") >= 0) {//entity
//覆盖entity
super.outputFile(file, objectMap, templatePath);
} else {//非entity,不做覆盖处理
return;
}
} else {//文件不存在
super.outputFile(file, objectMap, templatePath);
}
}
})
` 我这边是只覆盖entity文件,具体的情况可以具体调整