master
wangbing 6 years ago
parent 27eb55c978
commit 1387ad6137

@ -159,9 +159,6 @@ public class SpringBootCallable implements Callable {
{//生成resources文件
System.out.println("生成模块:Resources");
generateResources(resources, project, dataBase, option);
for (Module module : project.getModules()) {
generateResourcesSQL(resources, module, dataBase, option);
}
System.out.println("生成模块:Static");
generateStatic(resources, project, dataBase, option);
System.out.println("生成模块:Templates");
@ -573,6 +570,7 @@ public class SpringBootCallable implements Callable {
ctx.put("author", project.getProjectAuthor());
ctx.put("dBmapper", dBmapper);
ctx.put("date", new Date());
ctx.put("author", project.getProjectAuthor());
ctx.put("projectName", project.getProjectName());
ctx.put("cloud", cloud);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "start-dev.bat"), option + "/resources/start-dev.bat", ctx);
@ -592,34 +590,21 @@ public class SpringBootCallable implements Callable {
XmlManager xmlManager = ManagerFactory.getXmlManager();
xmlManager.saveAs(dbtool.getAbsolutePath(), project);
}
}
/**
* properties
*
* @param root
* @param md
*/
public void generateResourcesSQL(File root, Module md, DataBase dataBase, String option) {
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("basePackage", md.getProjectBasePackage());
ctx.put("moduleName", md.getModuleName());
ctx.put("tool", Tool.class);
ctx.put("dataBase", dataBase.toString());
ctx.put("module", md);
ctx.put("author", md.getProjectAuthor());
ctx.put("dBmapper", dBmapper);
ctx.put("date", new Date());
for (Module module : project.getModules()) {
ctx.put("moduleName", module.getModuleName());
ctx.put("module", module);
File tableDir = new File(root.getAbsolutePath(), md.getModuleName() + "_table");
tableDir.mkdirs();
File tableDir = new File(dbtool.getAbsolutePath(), module.getModuleName() + "_table");
tableDir.mkdirs();
for (Table table : md.getTables()) {
ctx.put("table", table);
freeMarkerManager.outputTemp(new File(tableDir.getAbsolutePath(), table.getTableName() + ".sql"), option + "/resources/table.ftl", ctx);
for (Table table : module.getTables()) {
ctx.put("table", table);
freeMarkerManager.outputTemp(new File(tableDir.getAbsolutePath(), table.getTableName() + ".sql"), option + "/resources/table.ftl", ctx);
}
freeMarkerManager.outputTemp(new File(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/tableAll.ftl", ctx);
}
freeMarkerManager.outputTemp(new File(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/tableAll.ftl", ctx);
}
public void generateTestResources(File root, Project project, DataBase dataBase, String option) {

Loading…
Cancel
Save

Powered by TurnKey Linux.