From 1387ad6137aaebd943c1a5327083b1382704d8ab Mon Sep 17 00:00:00 2001 From: wangbing Date: Fri, 10 May 2019 21:25:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manger/callable/SpringBootCallable.java | 39 ++++++------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java b/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java index 82a3d241..1346e286 100644 --- a/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java +++ b/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java @@ -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 ctx = new HashMap(); - 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) {