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 027f6d70..24c43367 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 @@ -23,7 +23,7 @@ public class SpringBootCallable implements Callable { private Project project; private String option; private boolean cloud; - + private AbstractDBmapper dBmapper; private FreeMarkerManager freeMarkerManager; public SpringBootCallable(String root, DataBase dataBase, Project project, String option, boolean cloud) { @@ -33,151 +33,100 @@ public class SpringBootCallable implements Callable { this.option = option; this.cloud = cloud; this.freeMarkerManager = ManagerFactory.getFreeMarkerManager(); + this.dBmapper = ProjectManager.dBmapper; } - private AbstractDBmapper dBmapper; public Boolean call() throws Exception { - dBmapper = ProjectManager.dBmapper; - // 创建项目文件夹 - File projectDir = new File(root, project.getProjectName()); - if (!projectDir.exists()) { - projectDir.mkdir(); - } else { - Tool.clear(projectDir); + File projectDir = Tool.createPath(root, project.getProjectName()); + // 清空内容 + Tool.clear(projectDir); + // 生成java目录 + File javaDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "main", "java"); + // 生成资源目录 + File resourcesDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "main", "resources"); + // 生成域名目录 + File domainDir = javaDir; + for (String s : project.getProjectBasePackage().split("\\.")) { + domainDir = Tool.createPath(domainDir.getAbsolutePath(), s); } + // 生成单元测试java目录 + File testJavaDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "test", "java"); + // 生成单元测试resources目录 + File testResourcesDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "test", "resources"); // 生成POM generatePom(projectDir, project, dataBase, option); - // 生成Maven-java及域名目录 - String basePackage = project.getProjectBasePackage(); - String[] split = basePackage.split("\\."); - StringBuffer stringBuffer = new StringBuffer(projectDir.getAbsolutePath() + File.separator + "src" + File.separator + "main"); - stringBuffer.append(File.separator).append("java"); - for (String s : split) { - stringBuffer.append(File.separator).append(s); - } - File src = new File(stringBuffer.toString()); - if (!src.exists()) { - src.mkdirs(); - } - File moduleDir = new File(src, "module"); - if (!moduleDir.exists()) { - moduleDir.mkdirs(); - } - - // 生成资源目录 - stringBuffer = new StringBuffer(projectDir.getAbsolutePath() + File.separator + "src" + File.separator + "main"); - stringBuffer.append(File.separator).append("resources"); - File resources = new File(stringBuffer.toString()); - if (!resources.exists()) { - resources.mkdirs(); - } - - // 生成单元测试java目录 - stringBuffer = new StringBuffer(projectDir.getAbsolutePath()); - stringBuffer.append(File.separator).append("src").append(File.separator).append("test").append(File.separator).append("java"); - for (String s : split) { - stringBuffer.append(File.separator).append(s); - } - File testSrc = new File(stringBuffer.toString()); - if (!testSrc.exists()) { - testSrc.mkdirs(); - } - - // 生成单元测试resources目录 - stringBuffer = new StringBuffer(projectDir.getAbsolutePath()); - stringBuffer.append(File.separator).append("src").append(File.separator).append("test").append(File.separator).append("resources"); - File testResources = new File(stringBuffer.toString()); - if (!testResources.exists()) { - testResources.mkdirs(); - } {//生成java文件 - //生成Controller + //生成 Controller System.out.println("生成模块:action"); - generateController(new File(src.getAbsolutePath(), "action"), project, dataBase, option); + generateController(Tool.createPath(domainDir.getAbsolutePath(), "action"), project, dataBase, option); - //生成Config + // 生成 Config System.out.println("生成模块:config"); - generateConfig(new File(src.getAbsolutePath(), "config"), project, dataBase, option); + generateConfig(Tool.createPath(domainDir.getAbsolutePath(), "config"), project, dataBase, option); - //module - { -// { -// -// Module module = new Module(); -// File api = new File(moduleDir.getAbsolutePath(), "api"); -// api.mkdirs(); -// module.setModuleName("api"); -// module.setProjectAuthor(project.getProjectAuthor()); -// module.setProjectBasePackage(project.getProjectBasePackage()); -// module.setProjectName(project.getProjectName()); -// -// System.out.println("生成模块:Entity"); -// generateEntity(new File(api.getAbsolutePath(), "ent"), module, dataBase, option); -// System.out.println("生成模块:Mapper"); -// generateMapper(new File(api.getAbsolutePath(), "mpr"), module, dataBase, option); -// System.out.println("生成模块:Manager"); -// generateManager(new File(api.getAbsolutePath(), "mgr"), module, dataBase, option); -// System.out.println("生成模块:Requset"); -// generateRequest(new File(api.getAbsolutePath(), "req"), module, dataBase, option); -// System.out.println("生成模块:Response"); -// generateResponse(new File(api.getAbsolutePath(), "rsp"), module, dataBase, option); -// } - for (Module module : project.getModules()) { + + {// 模块 + for (Module module : project.getModules()) {// 业务模块 module.setProjectAuthor(project.getProjectAuthor()); module.setProjectBasePackage(project.getProjectBasePackage()); module.setProjectName(project.getProjectName()); - File modulePath = new File(moduleDir.getAbsolutePath(), module.getModuleName()); - modulePath.mkdirs(); + File moduleDir = Tool.createPath(domainDir.getAbsolutePath(), "module", module.getModuleName()); System.out.println("生成模块:Entity"); - generateEntity(new File(modulePath.getAbsolutePath(), "ent"), module, dataBase, option); + generateEntity(Tool.createPath(moduleDir.getAbsolutePath(), "ent"), module, dataBase, option); System.out.println("生成模块:Mapper"); - generateMapper(new File(modulePath.getAbsolutePath(), "mpr"), module, dataBase, option); + generateMapper(Tool.createPath(moduleDir.getAbsolutePath(), "mpr"), module, dataBase, option); System.out.println("生成模块:Manager"); - generateManager(new File(modulePath.getAbsolutePath(), "mgr"), module, dataBase, option); + generateManager(Tool.createPath(moduleDir.getAbsolutePath(), "mgr"), module, dataBase, option); System.out.println("生成模块:Requset"); - generateRequest(new File(modulePath.getAbsolutePath(), "req"), module, dataBase, option); + generateRequest(Tool.createPath(moduleDir.getAbsolutePath(), "req"), module, dataBase, option); System.out.println("生成模块:Response"); - generateResponse(new File(modulePath.getAbsolutePath(), "rsp"), module, dataBase, option); + generateResponse(Tool.createPath(moduleDir.getAbsolutePath(), "rsp"), module, dataBase, option); } - { + {// 生成System模块 Module module = new Module(); module.setModuleName("system"); module.setProjectAuthor(project.getProjectAuthor()); module.setProjectBasePackage(project.getProjectBasePackage()); module.setProjectName(project.getProjectName()); - generateSystemModule(new File(moduleDir.getAbsolutePath(), "system"), module, dataBase, option); + File moduleDir = Tool.createPath(domainDir.getAbsolutePath(), "module", "system"); + generateSystemModule(moduleDir, module, dataBase, option); } } - //frame + // base 和 frame等内容 System.out.println("生成模块:frame"); - generateFrame(new File(src.getAbsolutePath(), "frame"), project, dataBase, option); + generateFrame(Tool.createPath(domainDir.getAbsolutePath(), "frame"), project, dataBase, option); + // Application System.out.println("生成模块:Application"); - generateApplication(new File(src.getAbsolutePath()), project, dataBase, option); + generateApplication(Tool.createPath(domainDir.getAbsolutePath()), project, dataBase, option); } {//生成resources文件 System.out.println("生成模块:Resources"); - generateResources(resources, project, dataBase, option); + generateResources(resourcesDir, project, dataBase, option); System.out.println("生成模块:Static"); - generateStatic(resources, project, dataBase, option); + generateStatic(resourcesDir, project, dataBase, option); System.out.println("生成模块:Templates"); - generateTemplates(resources, project, dataBase, option); + generateTemplates(resourcesDir, project, dataBase, option); } - {//生成test + {//生成Test System.out.println("生成模块:Test"); - generateTest(testSrc, project, dataBase, option); - generateTestResources(testResources, project, dataBase, option); + generateTest(testJavaDir, project, dataBase, option); + } + + {//生成Test Resources + System.out.println("生成模块:Test Resources"); + generateTestResources(testResourcesDir, project, dataBase, option); } System.out.println("finish"); return true; @@ -196,10 +145,7 @@ public class SpringBootCallable implements Callable { ctx.put("basePackage", project.getProjectBasePackage()); ctx.put("dataBase", dataBase.toString()); ctx.put("cloud", cloud); - - File file = new File(root.getAbsolutePath(), "pom.xml"); - - freeMarkerManager.outputTemp(file, option + "/pom.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "pom.xml"), option + "/pom.ftl", ctx); } @@ -210,37 +156,27 @@ public class SpringBootCallable implements Callable { * @param project */ public void generateController(File root, Project project, DataBase dataBase, String option) { - if (!root.exists()) { - root.mkdirs(); - } else { - Tool.clear(root); - } + Tool.clear(root); HashMap ctx = new HashMap(); ctx.put("basePackage", project.getProjectBasePackage()); ctx.put("author", project.getProjectAuthor()); ctx.put("date", new Date()); ctx.put("modules", project.getModules()); - File control = new File(root.getAbsolutePath(), "control"); - File screen = new File(root.getAbsolutePath(), "screen"); - screen.mkdirs(); - control.mkdirs(); - - freeMarkerManager.outputTemp(new File(control.getAbsolutePath(), "Header.java"), option + "/java/action/control/Header.java", ctx); + File control = Tool.createPath(root.getAbsolutePath(), "control"); + File screen = Tool.createPath(root.getAbsolutePath(), "screen"); + freeMarkerManager.outputTemp(Tool.createFile(control.getAbsolutePath(), "Header.java"), option + "/java/action/control/Header.java", ctx); { - File ajax = new File(root.getAbsolutePath(), "ajax"); - ajax.mkdirs(); - File system = new File(ajax.getAbsolutePath(), "system"); - system.mkdirs(); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "AuthAjax.java"), option + "/java/action/ajax/system/AuthAjax.java", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "DictAjax.java"), option + "/java/action/ajax/system/DictAjax.java", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "DictItemAjax.java"), option + "/java/action/ajax/system/DictItemAjax.java", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "FileAjax.java"), option + "/java/action/ajax/system/FileAjax.java", ctx); + File ajax = Tool.createPath(root.getAbsolutePath(), "ajax"); + File system = Tool.createPath(ajax.getAbsolutePath(), "system"); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "AuthAjax.java"), option + "/java/action/ajax/system/AuthAjax.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictAjax.java"), option + "/java/action/ajax/system/DictAjax.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictItemAjax.java"), option + "/java/action/ajax/system/DictItemAjax.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FileAjax.java"), option + "/java/action/ajax/system/FileAjax.java", ctx); for (Module module : project.getModules()) { - File m = new File(ajax.getAbsolutePath(), module.getModuleName()); - m.mkdirs(); + File m = Tool.createPath(ajax.getAbsolutePath(), module.getModuleName()); for (Table table : module.getTables()) { HashMap ctxss = new HashMap(); @@ -250,23 +186,21 @@ public class SpringBootCallable implements Callable { ctxss.put("date", new Date()); ctxss.put("table", table); - freeMarkerManager.outputTemp(new File(m.getAbsolutePath(), table.getCName() + "Ajax.java"), option + "/java/action/ajax/Ajax.java", ctxss); + freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Ajax.java"), option + "/java/action/ajax/Ajax.java", ctxss); } } } { - File api = new File(root.getAbsolutePath(), "api"); - api.mkdirs(); - File system = new File(api.getAbsolutePath(), "system"); - system.mkdirs(); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "AuthApi.java"), option + "/java/action/api/system/AuthApi.java", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "DictApi.java"), option + "/java/action/api/system/DictApi.java", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "DictItemApi.java"), option + "/java/action/api/system/DictItemApi.java", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "FileApi.java"), option + "/java/action/api/system/FileApi.java", ctx); + File api = Tool.createPath(root.getAbsolutePath(), "api"); + File system = Tool.createPath(api.getAbsolutePath(), "system"); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "AuthApi.java"), option + "/java/action/api/system/AuthApi.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictApi.java"), option + "/java/action/api/system/DictApi.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictItemApi.java"), option + "/java/action/api/system/DictItemApi.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FileApi.java"), option + "/java/action/api/system/FileApi.java", ctx); for (Module module : project.getModules()) { - File m = new File(api.getAbsolutePath(), module.getModuleName()); + File m = Tool.createPath(api.getAbsolutePath(), module.getModuleName()); m.mkdirs(); for (Table table : module.getTables()) { @@ -276,14 +210,14 @@ public class SpringBootCallable implements Callable { ctxss.put("author", project.getProjectAuthor()); ctxss.put("date", new Date()); ctxss.put("table", table); - freeMarkerManager.outputTemp(new File(m.getAbsolutePath(), table.getCName() + "Api.java"), option + "/java/action/api/Api.java", ctxss); + freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Api.java"), option + "/java/action/api/Api.java", ctxss); } } } - freeMarkerManager.outputTemp(new File(screen.getAbsolutePath(), "Index.java"), option + "/java/action/screen/Index.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "GlobalController.java"), option + "/java/action/GlobalController.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "Index.java"), option + "/java/action/screen/Index.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "GlobalController.java"), option + "/java/action/GlobalController.java", ctx); -// freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "AjaxController.java"), option + "/java/action/AjaxController.java", ctx); +// freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "AjaxController.java"), option + "/java/action/AjaxController.java", ctx); } public void generateConfig(File root, Project project, DataBase dataBase, String option) { @@ -298,12 +232,12 @@ public class SpringBootCallable implements Callable { ctx.put("date", new Date()); //config - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ThreadPoolConfig.java"), option + "/java/config/ThreadPoolConfig.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "WebMvcConfig.java"), option + "/java/config/WebMvcConfig.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ThreadPoolConfig.java"), option + "/java/config/ThreadPoolConfig.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "WebMvcConfig.java"), option + "/java/config/WebMvcConfig.java", ctx); } /** @@ -328,8 +262,7 @@ public class SpringBootCallable implements Callable { ctx.put("author", md.getProjectAuthor()); ctx.put("date", new Date()); - File file = new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + ".java"); - + File file = Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + ".java"); freeMarkerManager.outputTemp(file, option + "/java/module/ent/entity.ftl", ctx); } } @@ -358,12 +291,12 @@ public class SpringBootCallable implements Callable { for (Table table : md.getTables()) { ctx.put("table", table); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".java"), option + "/java/module/mpr/mapperJava.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".java"), option + "/java/module/mpr/mapperJava.ftl", ctx); if (md.isHasSysFields()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".xml"), option + "/java/module/mpr/mapper.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".xml"), option + "/java/module/mpr/mapper.ftl", ctx); } else { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".xml"), option + "/java/module/mpr/mapper_nosys.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".xml"), option + "/java/module/mpr/mapper_nosys.ftl", ctx); } } } @@ -384,14 +317,14 @@ public class SpringBootCallable implements Callable { ctx.put("date", new Date()); if (md.getModuleName().equals("api")) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManager" + ".java"), option + "/java/module/mgr/ApiManager.java", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManagerImpl" + ".java"), option + "/java/module/mgr/ApiManagerImpl.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ApiManager" + ".java"), option + "/java/module/mgr/ApiManager.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ApiManagerImpl" + ".java"), option + "/java/module/mgr/ApiManagerImpl.java", ctx); } for (Table table : md.getTables()) { ctx.put("table", table); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Manager" + ".java"), option + "/java/module/mgr/manager.ftl", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "ManagerImpl" + ".java"), option + "/java/module/mgr/managerImpl.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Manager" + ".java"), option + "/java/module/mgr/manager.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "ManagerImpl" + ".java"), option + "/java/module/mgr/managerImpl.ftl", ctx); } } @@ -417,37 +350,37 @@ public class SpringBootCallable implements Callable { ctx.put("date", new Date()); if (md.getModuleName().equals("api")) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleRequest" + ".java"), option + "/java/module/req/ApiExampleRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ApiExampleRequest" + ".java"), option + "/java/module/req/ApiExampleRequest.java", ctx); } for (Table table : md.getTables()) { ctx.put("table", table); if (table.getCreate()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "CreateRequest" + ".java"), option + "/java/module/req/createRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "CreateRequest" + ".java"), option + "/java/module/req/createRequestClass.ftl", ctx); } if (table.getDelete()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "DeleteRequest" + ".java"), option + "/java/module/req/deleteRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "DeleteRequest" + ".java"), option + "/java/module/req/deleteRequestClass.ftl", ctx); } if (table.getUpdate()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "UpdateRequest" + ".java"), option + "/java/module/req/updateRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "UpdateRequest" + ".java"), option + "/java/module/req/updateRequestClass.ftl", ctx); } if (table.getFind()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "FindRequest" + ".java"), option + "/java/module/req/findRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "FindRequest" + ".java"), option + "/java/module/req/findRequestClass.ftl", ctx); } if (table.getGet()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetRequest" + ".java"), option + "/java/module/req/getRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetRequest" + ".java"), option + "/java/module/req/getRequestClass.ftl", ctx); } if (table.getSearch()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "SearchRequest" + ".java"), option + "/java/module/req/searchRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "SearchRequest" + ".java"), option + "/java/module/req/searchRequestClass.ftl", ctx); } if (table.getGetAll()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetAllRequest" + ".java"), option + "/java/module/req/getAllRequestClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetAllRequest" + ".java"), option + "/java/module/req/getAllRequestClass.ftl", ctx); } } } @@ -474,52 +407,47 @@ public class SpringBootCallable implements Callable { ctx.put("date", new Date()); if (md.getModuleName().equals("api")) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleResponse" + ".java"), option + "/java/module/rsp/ApiExampleResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ApiExampleResponse" + ".java"), option + "/java/module/rsp/ApiExampleResponse.java", ctx); } for (Table table : md.getTables()) { ctx.put("table", table); if (table.getCreate()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "CreateResponse" + ".java"), option + "/java/module/rsp/createResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "CreateResponse" + ".java"), option + "/java/module/rsp/createResponseClass.ftl", ctx); } if (table.getDelete()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "DeleteResponse" + ".java"), option + "/java/module/rsp/deleteResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "DeleteResponse" + ".java"), option + "/java/module/rsp/deleteResponseClass.ftl", ctx); } if (table.getUpdate()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "UpdateResponse" + ".java"), option + "/java/module/rsp/updateResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "UpdateResponse" + ".java"), option + "/java/module/rsp/updateResponseClass.ftl", ctx); } if (table.getFind()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "FindResponse" + ".java"), option + "/java/module/rsp/findResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "FindResponse" + ".java"), option + "/java/module/rsp/findResponseClass.ftl", ctx); } if (table.getGet()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetResponse" + ".java"), option + "/java/module/rsp/getResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetResponse" + ".java"), option + "/java/module/rsp/getResponseClass.ftl", ctx); } if (table.getSearch()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "SearchResponse" + ".java"), option + "/java/module/rsp/searchResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "SearchResponse" + ".java"), option + "/java/module/rsp/searchResponseClass.ftl", ctx); } if (table.getGetAll()) { - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetAllResponse" + ".java"), option + "/java/module/rsp/getAllResponseClass.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetAllResponse" + ".java"), option + "/java/module/rsp/getAllResponseClass.ftl", ctx); } } } public void generateSystemModule(File root, Module md, DataBase dataBase, String option) { - File ent = new File(root.getAbsolutePath(), "ent"); - ent.mkdirs(); - File mpr = new File(root.getAbsolutePath(), "mpr"); - mpr.mkdirs(); - File mgr = new File(root.getAbsolutePath(), "mgr"); - mgr.mkdirs(); - File req = new File(root.getAbsolutePath(), "req"); - req.mkdirs(); - File rsp = new File(root.getAbsolutePath(), "rsp"); - rsp.mkdirs(); + File ent = Tool.createPath(root.getAbsolutePath(), "ent"); + File mpr = Tool.createPath(root.getAbsolutePath(), "mpr"); + File mgr = Tool.createPath(root.getAbsolutePath(), "mgr"); + File req = Tool.createPath(root.getAbsolutePath(), "req"); + File rsp = Tool.createPath(root.getAbsolutePath(), "rsp"); HashMap ctx = new HashMap(); ctx.put("basePackage", md.getProjectBasePackage()); @@ -527,61 +455,61 @@ public class SpringBootCallable implements Callable { ctx.put("author", md.getProjectAuthor()); ctx.put("date", new Date()); - freeMarkerManager.outputTemp(new File(ent.getAbsolutePath(), "Dict.java"), option + "/java/module/system/ent/Dict.java", ctx); - freeMarkerManager.outputTemp(new File(ent.getAbsolutePath(), "DictItem.java"), option + "/java/module/system/ent/DictItem.java", ctx); - freeMarkerManager.outputTemp(new File(ent.getAbsolutePath(), "File.java"), option + "/java/module/system/ent/File.java", ctx); - - freeMarkerManager.outputTemp(new File(mgr.getAbsolutePath(), "DictItemManager.java"), option + "/java/module/system/mgr/DictItemManager.java", ctx); - freeMarkerManager.outputTemp(new File(mgr.getAbsolutePath(), "DictItemManagerImpl.java"), option + "/java/module/system/mgr/DictItemManagerImpl.java", ctx); - freeMarkerManager.outputTemp(new File(mgr.getAbsolutePath(), "DictManager.java"), option + "/java/module/system/mgr/DictManager.java", ctx); - freeMarkerManager.outputTemp(new File(mgr.getAbsolutePath(), "DictManagerImpl.java"), option + "/java/module/system/mgr/DictManagerImpl.java", ctx); - freeMarkerManager.outputTemp(new File(mgr.getAbsolutePath(), "FileManager.java"), option + "/java/module/system/mgr/FileManager.java", ctx); - freeMarkerManager.outputTemp(new File(mgr.getAbsolutePath(), "FileManagerImpl.java"), option + "/java/module/system/mgr/FileManagerImpl.java", ctx); - - freeMarkerManager.outputTemp(new File(mpr.getAbsolutePath(), "DictItemMapper.java"), option + "/java/module/system/mpr/DictItemMapper.java", ctx); - freeMarkerManager.outputTemp(new File(mpr.getAbsolutePath(), "DictItemMapper.xml"), option + "/java/module/system/mpr/DictItemMapper.xml", ctx); - freeMarkerManager.outputTemp(new File(mpr.getAbsolutePath(), "DictMapper.java"), option + "/java/module/system/mpr/DictMapper.java", ctx); - freeMarkerManager.outputTemp(new File(mpr.getAbsolutePath(), "DictMapper.xml"), option + "/java/module/system/mpr/DictMapper.xml", ctx); - freeMarkerManager.outputTemp(new File(mpr.getAbsolutePath(), "FileMapper.java"), option + "/java/module/system/mpr/FileMapper.java", ctx); - freeMarkerManager.outputTemp(new File(mpr.getAbsolutePath(), "FileMapper.xml"), option + "/java/module/system/mpr/FileMapper.xml", ctx); - - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "AuthLoginRequest.java"), option + "/java/module/system/req/AuthLoginRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictCreateRequest.java"), option + "/java/module/system/req/DictCreateRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictDeleteRequest.java"), option + "/java/module/system/req/DictDeleteRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictFindRequest.java"), option + "/java/module/system/req/DictFindRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictGetRequest.java"), option + "/java/module/system/req/DictGetRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictItemCreateRequest.java"), option + "/java/module/system/req/DictItemCreateRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictItemDeleteRequest.java"), option + "/java/module/system/req/DictItemDeleteRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictItemFindRequest.java"), option + "/java/module/system/req/DictItemFindRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictItemGetRequest.java"), option + "/java/module/system/req/DictItemGetRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictItemUpdateRequest.java"), option + "/java/module/system/req/DictItemUpdateRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictLoadRequest.java"), option + "/java/module/system/req/DictLoadRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "DictUpdateRequest.java"), option + "/java/module/system/req/DictUpdateRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "FileCreateRequest.java"), option + "/java/module/system/req/FileCreateRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "FileDeleteRequest.java"), option + "/java/module/system/req/FileDeleteRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "FileDownloadRequest.java"), option + "/java/module/system/req/FileDownloadRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "FileFindRequest.java"), option + "/java/module/system/req/FileFindRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "FileGetRequest.java"), option + "/java/module/system/req/FileGetRequest.java", ctx); - freeMarkerManager.outputTemp(new File(req.getAbsolutePath(), "FileUploadRequest.java"), option + "/java/module/system/req/FileUploadRequest.java", ctx); - - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "AuthLoginResponse.java"), option + "/java/module/system/rsp/AuthLoginResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictCreateResponse.java"), option + "/java/module/system/rsp/DictCreateResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictDeleteResponse.java"), option + "/java/module/system/rsp/DictDeleteResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictFindResponse.java"), option + "/java/module/system/rsp/DictFindResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictGetResponse.java"), option + "/java/module/system/rsp/DictGetResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictItemCreateResponse.java"), option + "/java/module/system/rsp/DictItemCreateResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictItemDeleteResponse.java"), option + "/java/module/system/rsp/DictItemDeleteResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictItemFindResponse.java"), option + "/java/module/system/rsp/DictItemFindResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictItemGetResponse.java"), option + "/java/module/system/rsp/DictItemGetResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictItemUpdateResponse.java"), option + "/java/module/system/rsp/DictItemUpdateResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictLoadResponse.java"), option + "/java/module/system/rsp/DictLoadResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "DictUpdateResponse.java"), option + "/java/module/system/rsp/DictUpdateResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "FileCreateResponse.java"), option + "/java/module/system/rsp/FileCreateResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "FileDeleteResponse.java"), option + "/java/module/system/rsp/FileDeleteResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "FileDownloadResponse.java"), option + "/java/module/system/rsp/FileDownloadResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "FileFindResponse.java"), option + "/java/module/system/rsp/FileFindResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "FileGetResponse.java"), option + "/java/module/system/rsp/FileGetResponse.java", ctx); - freeMarkerManager.outputTemp(new File(rsp.getAbsolutePath(), "FileUploadResponse.java"), option + "/java/module/system/rsp/FileUploadResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "Dict.java"), option + "/java/module/system/ent/Dict.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "DictItem.java"), option + "/java/module/system/ent/DictItem.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "File.java"), option + "/java/module/system/ent/File.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictItemManager.java"), option + "/java/module/system/mgr/DictItemManager.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictItemManagerImpl.java"), option + "/java/module/system/mgr/DictItemManagerImpl.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictManager.java"), option + "/java/module/system/mgr/DictManager.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictManagerImpl.java"), option + "/java/module/system/mgr/DictManagerImpl.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "FileManager.java"), option + "/java/module/system/mgr/FileManager.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "FileManagerImpl.java"), option + "/java/module/system/mgr/FileManagerImpl.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictItemMapper.java"), option + "/java/module/system/mpr/DictItemMapper.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictItemMapper.xml"), option + "/java/module/system/mpr/DictItemMapper.xml", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictMapper.java"), option + "/java/module/system/mpr/DictMapper.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictMapper.xml"), option + "/java/module/system/mpr/DictMapper.xml", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "FileMapper.java"), option + "/java/module/system/mpr/FileMapper.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "FileMapper.xml"), option + "/java/module/system/mpr/FileMapper.xml", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "AuthLoginRequest.java"), option + "/java/module/system/req/AuthLoginRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictCreateRequest.java"), option + "/java/module/system/req/DictCreateRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictDeleteRequest.java"), option + "/java/module/system/req/DictDeleteRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictFindRequest.java"), option + "/java/module/system/req/DictFindRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictGetRequest.java"), option + "/java/module/system/req/DictGetRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemCreateRequest.java"), option + "/java/module/system/req/DictItemCreateRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemDeleteRequest.java"), option + "/java/module/system/req/DictItemDeleteRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemFindRequest.java"), option + "/java/module/system/req/DictItemFindRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemGetRequest.java"), option + "/java/module/system/req/DictItemGetRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemUpdateRequest.java"), option + "/java/module/system/req/DictItemUpdateRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictLoadRequest.java"), option + "/java/module/system/req/DictLoadRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictUpdateRequest.java"), option + "/java/module/system/req/DictUpdateRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileCreateRequest.java"), option + "/java/module/system/req/FileCreateRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileDeleteRequest.java"), option + "/java/module/system/req/FileDeleteRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileDownloadRequest.java"), option + "/java/module/system/req/FileDownloadRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileFindRequest.java"), option + "/java/module/system/req/FileFindRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileGetRequest.java"), option + "/java/module/system/req/FileGetRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileUploadRequest.java"), option + "/java/module/system/req/FileUploadRequest.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "AuthLoginResponse.java"), option + "/java/module/system/rsp/AuthLoginResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictCreateResponse.java"), option + "/java/module/system/rsp/DictCreateResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictDeleteResponse.java"), option + "/java/module/system/rsp/DictDeleteResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictFindResponse.java"), option + "/java/module/system/rsp/DictFindResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictGetResponse.java"), option + "/java/module/system/rsp/DictGetResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemCreateResponse.java"), option + "/java/module/system/rsp/DictItemCreateResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemDeleteResponse.java"), option + "/java/module/system/rsp/DictItemDeleteResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemFindResponse.java"), option + "/java/module/system/rsp/DictItemFindResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemGetResponse.java"), option + "/java/module/system/rsp/DictItemGetResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemUpdateResponse.java"), option + "/java/module/system/rsp/DictItemUpdateResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictLoadResponse.java"), option + "/java/module/system/rsp/DictLoadResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictUpdateResponse.java"), option + "/java/module/system/rsp/DictUpdateResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileCreateResponse.java"), option + "/java/module/system/rsp/FileCreateResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileDeleteResponse.java"), option + "/java/module/system/rsp/FileDeleteResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileDownloadResponse.java"), option + "/java/module/system/rsp/FileDownloadResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileFindResponse.java"), option + "/java/module/system/rsp/FileFindResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileGetResponse.java"), option + "/java/module/system/rsp/FileGetResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileUploadResponse.java"), option + "/java/module/system/rsp/FileUploadResponse.java", ctx); } /** @@ -601,104 +529,95 @@ public class SpringBootCallable implements Callable { ctx.put("moduleName", project.getProjectName()); ctx.put("timestamp", new Date().getTime()); - File auth = new File(root.getAbsolutePath(), "auth"); - auth.mkdirs(); - File base = new File(root.getAbsolutePath(), "base"); - base.mkdirs(); - File excel = new File(root.getAbsolutePath(), "excel"); - excel.mkdirs(); - File excelannotation = new File(excel.getAbsolutePath(), "annotation"); - excelannotation.mkdirs(); - File excelconverter = new File(excel.getAbsolutePath(), "converter"); - excelconverter.mkdirs(); - File exception = new File(excel.getAbsolutePath(), "exception"); - exception.mkdirs(); - File excelstyle = new File(excel.getAbsolutePath(), "style"); - excelstyle.mkdirs(); - File utils = new File(root.getAbsolutePath(), "utils"); - utils.mkdirs(); - File validation = new File(root.getAbsolutePath(), "validation"); - validation.mkdirs(); + File auth = Tool.createPath(root.getAbsolutePath(), "auth"); + File base = Tool.createPath(root.getAbsolutePath(), "base"); + File excel = Tool.createPath(root.getAbsolutePath(), "excel"); + File excelannotation = Tool.createPath(excel.getAbsolutePath(), "annotation"); + File excelconverter = Tool.createPath(excel.getAbsolutePath(), "converter"); + File exception = Tool.createPath(excel.getAbsolutePath(), "exception"); + File excelstyle = Tool.createPath(excel.getAbsolutePath(), "style"); + File utils = Tool.createPath(root.getAbsolutePath(), "utils"); + File validation = Tool.createPath(root.getAbsolutePath(), "validation"); //auth - freeMarkerManager.outputTemp(new File(auth.getAbsolutePath(), "LocalData.java"), option + "/java/frame/auth/LocalData.java", ctx); - freeMarkerManager.outputTemp(new File(auth.getAbsolutePath(), "Verification.java"), option + "/java/frame/auth/Verification.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(auth.getAbsolutePath(), "LocalData.java"), option + "/java/frame/auth/LocalData.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(auth.getAbsolutePath(), "Verification.java"), option + "/java/frame/auth/Verification.java", ctx); //base - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseEntity.java"), option + "/java/frame/base/BaseEntity.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseFindRequest.java"), option + "/java/frame/base/BaseFindRequest.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseFindResponse.java"), option + "/java/frame/base/BaseFindResponse.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseGetAllRequest.java"), option + "/java/frame/base/BaseGetAllRequest.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseRequest.java"), option + "/java/frame/base/BaseRequest.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseResponse.java"), option + "/java/frame/base/BaseResponse.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseSearchRequest.java"), option + "/java/frame/base/BaseSearchRequest.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "BaseUpdateRequest.java"), option + "/java/frame/base/BaseUpdateRequest.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "Control.java"), option + "/java/frame/base/Control.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "Error.java"), option + "/java/frame/base/Error.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "ErrorType.java"), option + "/java/frame/base/ErrorType.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "Screen.java"), option + "/java/frame/base/Screen.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "SortType.java"), option + "/java/frame/base/SortType.java", ctx); - freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "Token.java"), option + "/java/frame/base/Token.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseEntity.java"), option + "/java/frame/base/BaseEntity.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseFindRequest.java"), option + "/java/frame/base/BaseFindRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseFindResponse.java"), option + "/java/frame/base/BaseFindResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseGetAllRequest.java"), option + "/java/frame/base/BaseGetAllRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseRequest.java"), option + "/java/frame/base/BaseRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseResponse.java"), option + "/java/frame/base/BaseResponse.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseSearchRequest.java"), option + "/java/frame/base/BaseSearchRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseUpdateRequest.java"), option + "/java/frame/base/BaseUpdateRequest.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Control.java"), option + "/java/frame/base/Control.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Error.java"), option + "/java/frame/base/Error.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "ErrorType.java"), option + "/java/frame/base/ErrorType.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Screen.java"), option + "/java/frame/base/Screen.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "SortType.java"), option + "/java/frame/base/SortType.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Token.java"), option + "/java/frame/base/Token.java", ctx); //excel - freeMarkerManager.outputTemp(new File(excel.getAbsolutePath(), "WCell.java"), option + "/java/frame/excel/WCell.java", ctx); - freeMarkerManager.outputTemp(new File(excel.getAbsolutePath(), "WColumn.java"), option + "/java/frame/excel/WColumn.java", ctx); - freeMarkerManager.outputTemp(new File(excel.getAbsolutePath(), "WRow.java"), option + "/java/frame/excel/WRow.java", ctx); - freeMarkerManager.outputTemp(new File(excel.getAbsolutePath(), "WSheet.java"), option + "/java/frame/excel/WSheet.java", ctx); - - freeMarkerManager.outputTemp(new File(excelannotation.getAbsolutePath(), "ColumnDescription.java"), option + "/java/frame/excel/annotation/ColumnDescription.java", ctx); - freeMarkerManager.outputTemp(new File(excelannotation.getAbsolutePath(), "ColumnName.java"), option + "/java/frame/excel/annotation/ColumnName.java", ctx); - freeMarkerManager.outputTemp(new File(excelannotation.getAbsolutePath(), "Converter.java"), option + "/java/frame/excel/annotation/Converter.java", ctx); - freeMarkerManager.outputTemp(new File(excelannotation.getAbsolutePath(), "Ignore.java"), option + "/java/frame/excel/annotation/Ignore.java", ctx); - freeMarkerManager.outputTemp(new File(excelannotation.getAbsolutePath(), "ParentFirst.java"), option + "/java/frame/excel/annotation/ParentFirst.java", ctx); - freeMarkerManager.outputTemp(new File(excelannotation.getAbsolutePath(), "SheetName.java"), option + "/java/frame/excel/annotation/SheetName.java", ctx); - - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "BooleanConverter.java"), option + "/java/frame/excel/converter/BooleanConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "ByteConverter.java"), option + "/java/frame/excel/converter/ByteConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "CharacterConverter.java"), option + "/java/frame/excel/converter/CharacterConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "Converter.java"), option + "/java/frame/excel/converter/Converter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "DateConverter.java"), option + "/java/frame/excel/converter/DateConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "DoubleConverter.java"), option + "/java/frame/excel/converter/DoubleConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "FloatConverter.java"), option + "/java/frame/excel/converter/FloatConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "IntegerConverter.java"), option + "/java/frame/excel/converter/IntegerConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "LongConverter.java"), option + "/java/frame/excel/converter/LongConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "ShortConverter.java"), option + "/java/frame/excel/converter/ShortConverter.java", ctx); - freeMarkerManager.outputTemp(new File(excelconverter.getAbsolutePath(), "StringConverter.java"), option + "/java/frame/excel/converter/StringConverter.java", ctx); - - freeMarkerManager.outputTemp(new File(exception.getAbsolutePath(), "ReadErrorException.java"), option + "/java/frame/excel/exception/ReadErrorException.java", ctx); - freeMarkerManager.outputTemp(new File(exception.getAbsolutePath(), "TemplateNotMatchException.java"), option + "/java/frame/excel/exception/TemplateNotMatchException.java", ctx); - freeMarkerManager.outputTemp(new File(exception.getAbsolutePath(), "ValueConverterException.java"), option + "/java/frame/excel/exception/ValueConverterException.java", ctx); - - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "BaseCellStyle.java"), option + "/java/frame/excel/style/BaseCellStyle.java", ctx); - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "BaseFont.java"), option + "/java/frame/excel/style/BaseFont.java", ctx); - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "DataCellStyle.java"), option + "/java/frame/excel/style/DataCellStyle.java", ctx); - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "ErrorCellStyle.java"), option + "/java/frame/excel/style/ErrorCellStyle.java", ctx); - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "HeadCellStyle.java"), option + "/java/frame/excel/style/HeadCellStyle.java", ctx); - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "NormalFont.java"), option + "/java/frame/excel/style/NormalFont.java", ctx); - freeMarkerManager.outputTemp(new File(excelstyle.getAbsolutePath(), "RedFont.java"), option + "/java/frame/excel/style/RedFont.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WCell.java"), option + "/java/frame/excel/WCell.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WColumn.java"), option + "/java/frame/excel/WColumn.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WRow.java"), option + "/java/frame/excel/WRow.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WSheet.java"), option + "/java/frame/excel/WSheet.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "ColumnDescription.java"), option + "/java/frame/excel/annotation/ColumnDescription.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "ColumnName.java"), option + "/java/frame/excel/annotation/ColumnName.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "Converter.java"), option + "/java/frame/excel/annotation/Converter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "Ignore.java"), option + "/java/frame/excel/annotation/Ignore.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "ParentFirst.java"), option + "/java/frame/excel/annotation/ParentFirst.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "SheetName.java"), option + "/java/frame/excel/annotation/SheetName.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "BooleanConverter.java"), option + "/java/frame/excel/converter/BooleanConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "ByteConverter.java"), option + "/java/frame/excel/converter/ByteConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "CharacterConverter.java"), option + "/java/frame/excel/converter/CharacterConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "Converter.java"), option + "/java/frame/excel/converter/Converter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "DateConverter.java"), option + "/java/frame/excel/converter/DateConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "DoubleConverter.java"), option + "/java/frame/excel/converter/DoubleConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "FloatConverter.java"), option + "/java/frame/excel/converter/FloatConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "IntegerConverter.java"), option + "/java/frame/excel/converter/IntegerConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "LongConverter.java"), option + "/java/frame/excel/converter/LongConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "ShortConverter.java"), option + "/java/frame/excel/converter/ShortConverter.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "StringConverter.java"), option + "/java/frame/excel/converter/StringConverter.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), "ReadErrorException.java"), option + "/java/frame/excel/exception/ReadErrorException.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), "TemplateNotMatchException.java"), option + "/java/frame/excel/exception/TemplateNotMatchException.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), "ValueConverterException.java"), option + "/java/frame/excel/exception/ValueConverterException.java", ctx); + + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "BaseCellStyle.java"), option + "/java/frame/excel/style/BaseCellStyle.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "BaseFont.java"), option + "/java/frame/excel/style/BaseFont.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "DataCellStyle.java"), option + "/java/frame/excel/style/DataCellStyle.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "ErrorCellStyle.java"), option + "/java/frame/excel/style/ErrorCellStyle.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "HeadCellStyle.java"), option + "/java/frame/excel/style/HeadCellStyle.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "NormalFont.java"), option + "/java/frame/excel/style/NormalFont.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "RedFont.java"), option + "/java/frame/excel/style/RedFont.java", ctx); //uitls - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "Base64Util.java"), option + "/java/frame/utils/Base64Util.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "AESUtil.java"), option + "/java/frame/utils/AESUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ClassUtil.java"), option + "/java/frame/utils/ClassUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "CookieUtil.java"), option + "/java/frame/utils/CookieUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "FileUtil.java"), option + "/java/frame/utils/FileUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "LogUtil.java"), option + "/java/frame/utils/LogUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "MapperUtil.java"), option + "/java/frame/utils/MapperUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "MD5Util.java"), option + "/java/frame/utils/MD5Util.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ProcessUtil.java"), option + "/java/frame/utils/ProcessUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ResponseUtil.java"), option + "/java/frame/utils/ResponseUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "RSAUtil.java"), option + "/java/frame/utils/RSAUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "StringUtil.java"), option + "/java/frame/utils/StringUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ValidationUtil.java"), option + "/java/frame/utils/ValidationUtil.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "WebUtils.java"), option + "/java/frame/utils/WebUtils.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "IDgenerator.java"), option + "/java/frame/utils/IDgenerator.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "Message.java"), option + "/java/frame/utils/Message.java", ctx); - freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "UrlUtil.java"), option + "/java/frame/utils/UrlUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "Base64Util.java"), option + "/java/frame/utils/Base64Util.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "AESUtil.java"), option + "/java/frame/utils/AESUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ClassUtil.java"), option + "/java/frame/utils/ClassUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "CookieUtil.java"), option + "/java/frame/utils/CookieUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "FileUtil.java"), option + "/java/frame/utils/FileUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "LogUtil.java"), option + "/java/frame/utils/LogUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "MapperUtil.java"), option + "/java/frame/utils/MapperUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "MD5Util.java"), option + "/java/frame/utils/MD5Util.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ProcessUtil.java"), option + "/java/frame/utils/ProcessUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ResponseUtil.java"), option + "/java/frame/utils/ResponseUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "RSAUtil.java"), option + "/java/frame/utils/RSAUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "StringUtil.java"), option + "/java/frame/utils/StringUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ValidationUtil.java"), option + "/java/frame/utils/ValidationUtil.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "WebUtils.java"), option + "/java/frame/utils/WebUtils.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "IDgenerator.java"), option + "/java/frame/utils/IDgenerator.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "Message.java"), option + "/java/frame/utils/Message.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "UrlUtil.java"), option + "/java/frame/utils/UrlUtil.java", ctx); //validation - freeMarkerManager.outputTemp(new File(validation.getAbsolutePath(), "Dict.java"), option + "/java/frame/validation/Dict.java", ctx); - freeMarkerManager.outputTemp(new File(validation.getAbsolutePath(), "DictValidator.java"), option + "/java/frame/validation/DictValidator.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(validation.getAbsolutePath(), "Dict.java"), option + "/java/frame/validation/Dict.java", ctx); + freeMarkerManager.outputTemp(Tool.createFile(validation.getAbsolutePath(), "DictValidator.java"), option + "/java/frame/validation/DictValidator.java", ctx); } /** @@ -714,7 +633,7 @@ public class SpringBootCallable implements Callable { ctx.put("moduleName", project.getProjectName()); ctx.put("timestamp", new Date().getTime()); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "Application.java"), option + "/java/Application.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "Application.java"), option + "/java/Application.ftl", ctx); } /** @@ -735,21 +654,19 @@ public class SpringBootCallable implements Callable { 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); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "start-prod.bat"), option + "/resources/start-prod.bat", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "application-dev.properties"), option + "/resources/application-dev.ftl", ctx); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "application-prod.properties"), option + "/resources/application-prod.ftl", ctx); - Tool.outputResource(option + "/resources/banner.txt", new File(root.getAbsolutePath(), "banner.txt")); - Tool.outputResource(option + "/resources/logback-spring.xml", new File(root.getAbsolutePath(), "logback-spring.xml")); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "start-dev.bat"), option + "/resources/start-dev.bat", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "start-prod.bat"), option + "/resources/start-prod.bat", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application-dev.properties"), option + "/resources/application-dev.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application-prod.properties"), option + "/resources/application-prod.ftl", ctx); + Tool.outputResource(option + "/resources/banner.txt", Tool.createFile(root.getAbsolutePath(), "banner.txt")); + Tool.outputResource(option + "/resources/logback-spring.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring.xml")); if (DataBase.ORACLE == dataBase) { - File lib = new File(root.getAbsolutePath(), "lib"); - lib.mkdirs(); - Tool.outputResource(option + "/resources/lib/ojdbc7-12.1.0.2.jar", new File(lib.getAbsolutePath(), "ojdbc7-12.1.0.2.jar")); + File lib = Tool.createPath(root.getAbsolutePath(), "lib"); + Tool.outputResource(option + "/resources/lib/ojdbc7-12.1.0.2.jar", Tool.createFile(lib.getAbsolutePath(), "ojdbc7-12.1.0.2.jar")); } - File dbtool = new File(root.getAbsolutePath(), "dbtool"); - dbtool.mkdirs(); + File dbtool = Tool.createPath(root.getAbsolutePath(), "dbtool"); { XmlManager xmlManager = ManagerFactory.getXmlManager(); xmlManager.saveAs(dbtool, project); @@ -758,24 +675,19 @@ public class SpringBootCallable implements Callable { for (Module module : project.getModules()) { ctx.put("moduleName", module.getModuleName()); ctx.put("module", module); - - File tableDir = new File(dbtool.getAbsolutePath(), module.getModuleName() + "_table"); - tableDir.mkdirs(); - + File tableDir = Tool.createPath(dbtool.getAbsolutePath(), module.getModuleName() + "_table"); for (Table table : module.getTables()) { ctx.put("table", table); - freeMarkerManager.outputTemp(new File(tableDir.getAbsolutePath(), table.getTableName() + ".sql"), option + "/resources/dbtool/table.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), table.getTableName() + ".sql"), option + "/resources/dbtool/table.ftl", ctx); } - freeMarkerManager.outputTemp(new File(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/tableAll.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/tableAll.ftl", ctx); } { - File system = new File(dbtool.getAbsolutePath(), "system"); - system.mkdirs(); - - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "DICT.sql"), option + "/resources/dbtool/system/DICT.sql", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "DICT_ITEM.sql"), option + "/resources/dbtool/system/DICT_ITEM.sql", ctx); - freeMarkerManager.outputTemp(new File(system.getAbsolutePath(), "FILE.sql"), option + "/resources/dbtool/system/FILE.sql", ctx); + File system = Tool.createPath(dbtool.getAbsolutePath(), "system"); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DICT.sql"), option + "/resources/dbtool/system/DICT.sql", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DICT_ITEM.sql"), option + "/resources/dbtool/system/DICT_ITEM.sql", ctx); + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FILE.sql"), option + "/resources/dbtool/system/FILE.sql", ctx); } @@ -791,8 +703,8 @@ public class SpringBootCallable implements Callable { ctx.put("author", project.getProjectAuthor()); ctx.put("dBmapper", dBmapper); ctx.put("date", new Date()); - freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "application.properties"), option + "/test/application.properties", ctx); - Tool.outputResource(option + "/test/logback-spring.xml", new File(root.getAbsolutePath(), "logback-spring.xml")); + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application.properties"), option + "/test/application.properties", ctx); + Tool.outputResource(option + "/test/logback-spring.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring.xml")); } /** @@ -810,49 +722,34 @@ public class SpringBootCallable implements Callable { ctx.put("date", new Date()); ctx.put("modules", project.getModules()); - File static_ = new File(root.getAbsolutePath(), "static"); - boolean mkdirs = static_.mkdirs(); - File css = new File(static_.getAbsolutePath(), "css"); - boolean mkdirs1 = css.mkdirs(); - File img = new File(static_.getAbsolutePath(), "img"); - boolean mkdirs3 = img.mkdirs(); - - File dist = new File(static_.getAbsolutePath(), "dist"); - boolean mkdirs4 = dist.mkdirs(); + File static_ = Tool.createPath(root.getAbsolutePath(), "static"); + File css = Tool.createPath(static_.getAbsolutePath(), "css"); + File img = Tool.createPath(static_.getAbsolutePath(), "img"); + File dist = Tool.createPath(static_.getAbsolutePath(), "dist"); { - Tool.outputResource(option + "/resources/static/favicon.ico", new File(static_.getAbsolutePath(), "favicon.ico")); + Tool.outputResource(option + "/resources/static/favicon.ico", Tool.createFile(static_.getAbsolutePath(), "favicon.ico")); } {//css文件 - freeMarkerManager.outputTemp(new File(css.getAbsolutePath(), "base.css"), option + "/resources/static/css/base.css", ctx); + freeMarkerManager.outputTemp(Tool.createFile(css.getAbsolutePath(), "base.css"), option + "/resources/static/css/base.css", ctx); } {//img - Tool.outputResource(option + "/resources/static/img/logo.png", new File(img.getAbsolutePath(), "logo.png")); + Tool.outputResource(option + "/resources/static/img/logo.png", Tool.createFile(img.getAbsolutePath(), "logo.png")); } {//dist文件 //jquery + vue + vue-router + axios - Tool.outputResource(option + "/resources/static/dist/lib.min.js", new File(dist.getAbsolutePath(), "lib.min.js")); + Tool.outputResource(option + "/resources/static/dist/lib.min.js", Tool.createFile(dist.getAbsolutePath(), "lib.min.js")); //element-ui - Tool.outputResource(option + "/resources/static/dist/index.min.js", new File(dist.getAbsolutePath(), "index.min.js")); - Tool.outputResource(option + "/resources/static/dist/index.min.css", new File(dist.getAbsolutePath(), "index.min.css")); - - //vonic -// Tool.outputResource(option + "/resources/static/dist/vonic.min.js", new File(dist.getAbsolutePath(), "vonic.min.js")); -// Tool.outputResource(option + "/resources/static/dist/vonic.min.css", new File(dist.getAbsolutePath(), "vonic.min.css")); - - //mint-ui -// Tool.outputResource(option + "/resources/static/dist/mint-ui.min.js", new File(dist.getAbsolutePath(), "mint-ui.min.js")); -// Tool.outputResource(option + "/resources/static/dist/mint-ui.min.css", new File(dist.getAbsolutePath(), "mint-ui.min.css")); + Tool.outputResource(option + "/resources/static/dist/index.min.js", Tool.createFile(dist.getAbsolutePath(), "index.min.js")); + Tool.outputResource(option + "/resources/static/dist/index.min.css", Tool.createFile(dist.getAbsolutePath(), "index.min.css")); - File fonts = new File(dist.getAbsolutePath(), "fonts"); - fonts.mkdirs(); - Tool.outputResource(option + "/resources/static/dist/fonts/w-e-icon.woff", new File(fonts.getAbsolutePath(), "w-e-icon.woff")); - - Tool.outputResource(option + "/resources/static/dist/fonts/element-icons.woff", new File(fonts.getAbsolutePath(), "element-icons.woff")); + File fonts = Tool.createPath(dist.getAbsolutePath(), "fonts"); + Tool.outputResource(option + "/resources/static/dist/fonts/w-e-icon.woff", Tool.createFile(fonts.getAbsolutePath(), "w-e-icon.woff")); + Tool.outputResource(option + "/resources/static/dist/fonts/element-icons.woff", Tool.createFile(fonts.getAbsolutePath(), "element-icons.woff")); } } @@ -865,34 +762,30 @@ public class SpringBootCallable implements Callable { */ public void generateTemplates(File root, Project project, DataBase dataBase, String option) { {//生成 - File templates = new File(root.getAbsolutePath(), "templates"); + File templates = Tool.createPath(root.getAbsolutePath(), "templates"); templates.mkdirs(); - File control = new File(templates.getAbsolutePath(), "control"); - control.mkdirs(); - File layout = new File(templates.getAbsolutePath(), "layout"); - layout.mkdirs(); - File screen = new File(templates.getAbsolutePath(), "screen"); - screen.mkdirs(); - File system = new File(screen.getAbsolutePath(), "system"); - system.mkdirs(); - Tool.outputResource(option + "/resources/templates/control/nav.ftl", new File(control.getAbsolutePath(), "nav.ftl")); -// Tool.outputResource(option + "/resources/templates/control/header.ftl", new File(control.getAbsolutePath(), "header.ftl")); -// Tool.outputResource(option + "/resources/templates/control/footer.ftl", new File(control.getAbsolutePath(), "footer.ftl")); - Tool.outputResource(option + "/resources/templates/control/macro.ftl", new File(control.getAbsolutePath(), "macro.ftl")); -// Tool.outputResource(option + "/resources/templates/control/mint-ui-extend.ftl", new File(control.getAbsolutePath(), "mint-ui-extend.ftl")); - Tool.outputResource(option + "/resources/templates/layout/default.ftl", new File(layout.getAbsolutePath(), "default.ftl")); - Tool.outputResource(option + "/resources/templates/layout/index.ftl", new File(layout.getAbsolutePath(), "index.ftl")); -// Tool.outputResource(option + "/resources/templates/layout/app.ftl", new File(layout.getAbsolutePath(), "app.ftl")); - Tool.outputResource(option + "/resources/templates/screen/home.ftl", new File(screen.getAbsolutePath(), "home.ftl")); - Tool.outputResource(option + "/resources/templates/screen/login.ftl", new File(screen.getAbsolutePath(), "login.ftl")); - Tool.outputResource(option + "/resources/templates/403.ftl", new File(templates.getAbsolutePath(), "403.ftl")); - Tool.outputResource(option + "/resources/templates/404.ftl", new File(templates.getAbsolutePath(), "404.ftl")); - Tool.outputResource(option + "/resources/templates/500.ftl", new File(templates.getAbsolutePath(), "500.ftl")); - - Tool.outputResource(option + "/resources/templates/screen/module/system/dict.ftl", new File(system.getAbsolutePath(), "dict.ftl")); - Tool.outputResource(option + "/resources/templates/screen/module/system/dictItem.ftl", new File(system.getAbsolutePath(), "dictItem.ftl")); - Tool.outputResource(option + "/resources/templates/screen/module/system/file.ftl", new File(system.getAbsolutePath(), "file.ftl")); + File control = Tool.createPath(templates.getAbsolutePath(), "control"); + File layout = Tool.createPath(templates.getAbsolutePath(), "layout"); + File screen = Tool.createPath(templates.getAbsolutePath(), "screen"); + File system = Tool.createPath(screen.getAbsolutePath(), "system"); + Tool.outputResource(option + "/resources/templates/control/nav.ftl", Tool.createFile(control.getAbsolutePath(), "nav.ftl")); +// Tool.outputResource(option + "/resources/templates/control/header.ftl", Tool.createFile(control.getAbsolutePath(), "header.ftl")); +// Tool.outputResource(option + "/resources/templates/control/footer.ftl", Tool.createFile(control.getAbsolutePath(), "footer.ftl")); + Tool.outputResource(option + "/resources/templates/control/macro.ftl", Tool.createFile(control.getAbsolutePath(), "macro.ftl")); +// Tool.outputResource(option + "/resources/templates/control/mint-ui-extend.ftl", Tool.createFile(control.getAbsolutePath(), "mint-ui-extend.ftl")); + Tool.outputResource(option + "/resources/templates/layout/default.ftl", Tool.createFile(layout.getAbsolutePath(), "default.ftl")); + Tool.outputResource(option + "/resources/templates/layout/index.ftl", Tool.createFile(layout.getAbsolutePath(), "index.ftl")); +// Tool.outputResource(option + "/resources/templates/layout/app.ftl", Tool.createFile(layout.getAbsolutePath(), "app.ftl")); + Tool.outputResource(option + "/resources/templates/screen/home.ftl", Tool.createFile(screen.getAbsolutePath(), "home.ftl")); + Tool.outputResource(option + "/resources/templates/screen/login.ftl", Tool.createFile(screen.getAbsolutePath(), "login.ftl")); + Tool.outputResource(option + "/resources/templates/403.ftl", Tool.createFile(templates.getAbsolutePath(), "403.ftl")); + Tool.outputResource(option + "/resources/templates/404.ftl", Tool.createFile(templates.getAbsolutePath(), "404.ftl")); + Tool.outputResource(option + "/resources/templates/500.ftl", Tool.createFile(templates.getAbsolutePath(), "500.ftl")); + + Tool.outputResource(option + "/resources/templates/screen/module/system/dict.ftl", Tool.createFile(system.getAbsolutePath(), "dict.ftl")); + Tool.outputResource(option + "/resources/templates/screen/module/system/dictItem.ftl", Tool.createFile(system.getAbsolutePath(), "dictItem.ftl")); + Tool.outputResource(option + "/resources/templates/screen/module/system/file.ftl", Tool.createFile(system.getAbsolutePath(), "file.ftl")); { HashMap ctx = new HashMap(); @@ -901,17 +794,15 @@ public class SpringBootCallable implements Callable { ctx.put("author", project.getProjectAuthor()); ctx.put("date", new Date()); ctx.put("modules", project.getModules()); - freeMarkerManager.outputTemp(new File(screen.getAbsolutePath(), "index.ftl"), option + "/resources/templates/screen/index.ftl", ctx); + freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "index.ftl"), option + "/resources/templates/screen/index.ftl", ctx); } - for (Module mo : project.getModules()) { if (mo.isHasSysFields()) {//标准模型才好生成简单的htm for (Table table : mo.getTables()) { if (table.getHtml()) { - File module = new File(screen.getAbsolutePath(), mo.getModuleName()); - module.mkdirs(); + File module = Tool.createPath(screen.getAbsolutePath(), mo.getModuleName()); HashMap ctx = new HashMap(); ctx.put("basePackage", project.getProjectBasePackage()); ctx.put("tool", Tool.class); @@ -920,7 +811,8 @@ public class SpringBootCallable implements Callable { ctx.put("table", table); ctx.put("module", module.getName()); ctx.put("fields", table.getFields()); - freeMarkerManager.outputTemp(new File(module.getAbsolutePath(), table.getFName() + ".ftl"), option + "/resources/templates/screen/module/mgr.ftl", ctx); + File file = Tool.createFile(module.getAbsolutePath(), table.getFName() + ".ftl"); + freeMarkerManager.outputTemp(file, option + "/resources/templates/screen/module/mgr.ftl", ctx); } } } @@ -931,7 +823,7 @@ public class SpringBootCallable implements Callable { public void generateTest(File root, Project project, DataBase dataBase, String option) { { - File config = new File(root.getAbsolutePath(), "config"); + File config = Tool.createPath(root.getAbsolutePath(), "config"); config.mkdirs(); HashMap ctx = new HashMap(); ctx.put("tool", Tool.class); @@ -939,7 +831,8 @@ public class SpringBootCallable implements Callable { ctx.put("moduleName", project.getProjectName()); ctx.put("author", project.getProjectAuthor()); ctx.put("date", new Date()); - freeMarkerManager.outputTemp(new File(config.getAbsolutePath(), "TestConfig" + ".java"), option + "/test/TestConfig.ftl", ctx); + File file = Tool.createFile(config.getAbsolutePath(), "TestConfig" + ".java"); + freeMarkerManager.outputTemp(file, option + "/test/TestConfig.ftl", ctx); } { @@ -949,11 +842,12 @@ public class SpringBootCallable implements Callable { ctx.put("moduleName", project.getProjectName()); ctx.put("author", project.getProjectAuthor()); ctx.put("date", new Date()); - freeMarkerManager.outputTemp(new File(root, "UtilTest" + ".java"), option + "/test/UtilTest.java", ctx); + File file = Tool.createPath(root.getAbsolutePath(), "UtilTest" + ".java"); + freeMarkerManager.outputTemp(file, option + "/test/UtilTest.java", ctx); } for (Module md : project.getModules()) { - File module = new File(root.getAbsolutePath(), md.getModuleName()); + File module = Tool.createPath(root.getAbsolutePath(), md.getModuleName()); module.mkdirs(); for (Table table : md.getTables()) { @@ -967,7 +861,8 @@ public class SpringBootCallable implements Callable { ctx.put("author", md.getProjectAuthor()); ctx.put("date", new Date()); - freeMarkerManager.outputTemp(new File(module.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Test" + ".java"), option + "/test/test.ftl", ctx); + File file = Tool.createFile(module.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Test" + ".java"); + freeMarkerManager.outputTemp(file, option + "/test/test.ftl", ctx); } }