|
@@ -31,6 +31,7 @@ public class Generator {
|
|
|
|
|
|
private static void generatorToFile(String db_url, String db_username, String db_password, String author, String javaDir, String parentPackage, String moduleName, String tableName, String tablePrefix) {
|
|
|
FastAutoGenerator.create(db_url, db_username, db_password)
|
|
|
+ //===全局配置
|
|
|
.globalConfig(builder -> {
|
|
|
builder.author(author) // 设置作者
|
|
|
.dateType(DateType.ONLY_DATE) // 设置日期为 Date
|
|
@@ -38,6 +39,7 @@ public class Generator {
|
|
|
.fileOverride() // 覆盖已生成文件
|
|
|
.outputDir(javaDir); // 指定输出目录
|
|
|
})
|
|
|
+ //===模块配置
|
|
|
.packageConfig(builder -> {
|
|
|
builder.parent(parentPackage) // 设置父包名
|
|
|
.moduleName(moduleName) // 设置父包模块名
|
|
@@ -56,6 +58,9 @@ public class Generator {
|
|
|
|
|
|
})
|
|
|
.templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
|
|
|
+ //.templateConfig(builder -> builder.controller("")) // 设置为空则不会生成该文件
|
|
|
+ //.templateConfig(builder -> builder.service(""))
|
|
|
+ //.templateConfig(builder -> builder.serviceImpl(""))
|
|
|
.execute();
|
|
|
}
|
|
|
}
|