|
|
@ -55,35 +55,36 @@ public class SpringBootCallable implements Callable {
|
|
|
|
// 清空内容
|
|
|
|
// 清空内容
|
|
|
|
Tool.clear(projectDir);
|
|
|
|
Tool.clear(projectDir);
|
|
|
|
// 生成java目录
|
|
|
|
// 生成java目录
|
|
|
|
File javaDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "main", "java");
|
|
|
|
File javaDir = Tool.createPath(projectDir, "src", "main", "java");
|
|
|
|
// 生成资源目录
|
|
|
|
// 生成资源目录
|
|
|
|
File resourcesDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "main", "resources");
|
|
|
|
File resourcesDir = Tool.createPath(projectDir, "src", "main", "resources");
|
|
|
|
// 生成域名目录
|
|
|
|
// 生成域名目录
|
|
|
|
File domainDir = javaDir;
|
|
|
|
File domainDir = javaDir;
|
|
|
|
for (String s : project.getProjectBasePackage().split("\\.")) {
|
|
|
|
for (String s : project.getProjectBasePackage().split("\\.")) {
|
|
|
|
domainDir = Tool.createPath(domainDir.getAbsolutePath(), s);
|
|
|
|
domainDir = Tool.createPath(domainDir, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 生成单元测试java目录
|
|
|
|
// 生成单元测试java目录
|
|
|
|
File testJavaDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "test", "java");
|
|
|
|
File testJavaDir = Tool.createPath(projectDir, "src", "test", "java");
|
|
|
|
File testDomainDir = testJavaDir;
|
|
|
|
File testDomainDir = testJavaDir;
|
|
|
|
for (String s : project.getProjectBasePackage().split("\\.")) {
|
|
|
|
for (String s : project.getProjectBasePackage().split("\\.")) {
|
|
|
|
testDomainDir = Tool.createPath(testDomainDir.getAbsolutePath(), s);
|
|
|
|
testDomainDir = Tool.createPath(testDomainDir, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 生成单元测试resources目录
|
|
|
|
// 生成单元测试resources目录
|
|
|
|
File testResourcesDir = Tool.createPath(projectDir.getAbsolutePath(), "src", "test", "resources");
|
|
|
|
File testResourcesDir = Tool.createPath(projectDir, "src", "test", "resources");
|
|
|
|
|
|
|
|
|
|
|
|
// 生成POM
|
|
|
|
// 生成POM
|
|
|
|
generatePom(projectDir, project);
|
|
|
|
generatePom(projectDir, project);
|
|
|
|
|
|
|
|
|
|
|
|
{//生成java文件
|
|
|
|
{//生成java文件
|
|
|
|
//生成 Controller
|
|
|
|
//生成 Controller
|
|
|
|
System.out.println("生成模块:action");
|
|
|
|
if (project.isNeedWeb() || project.isNeedApi()) {
|
|
|
|
generateController(Tool.createPath(domainDir.getAbsolutePath(), "action"), project);
|
|
|
|
System.out.println("生成模块:action");
|
|
|
|
|
|
|
|
generateController(Tool.createPath(domainDir, "action"), project);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 生成 Config
|
|
|
|
// 生成 Config
|
|
|
|
System.out.println("生成模块:config");
|
|
|
|
System.out.println("生成模块:config");
|
|
|
|
generateConfig(Tool.createPath(domainDir.getAbsolutePath(), "config"), project);
|
|
|
|
generateConfig(Tool.createPath(domainDir, "config"), project);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{// 模块
|
|
|
|
{// 模块
|
|
|
|
for (Module module : project.getModules()) {// 业务模块
|
|
|
|
for (Module module : project.getModules()) {// 业务模块
|
|
|
@ -92,18 +93,18 @@ public class SpringBootCallable implements Callable {
|
|
|
|
module.setProjectBasePackage(project.getProjectBasePackage());
|
|
|
|
module.setProjectBasePackage(project.getProjectBasePackage());
|
|
|
|
module.setProjectName(project.getProjectName());
|
|
|
|
module.setProjectName(project.getProjectName());
|
|
|
|
|
|
|
|
|
|
|
|
File moduleDir = Tool.createPath(domainDir.getAbsolutePath(), "module", module.getModuleName());
|
|
|
|
File moduleDir = Tool.createPath(domainDir, "module", module.getModuleName());
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("生成模块:Entity");
|
|
|
|
System.out.println("生成模块:Entity");
|
|
|
|
generateEntity(Tool.createPath(moduleDir.getAbsolutePath(), "ent"), module);
|
|
|
|
generateEntity(Tool.createPath(moduleDir, "ent"), module);
|
|
|
|
System.out.println("生成模块:Mapper");
|
|
|
|
System.out.println("生成模块:Mapper");
|
|
|
|
generateMapper(Tool.createPath(moduleDir.getAbsolutePath(), "mpr"), module);
|
|
|
|
generateMapper(Tool.createPath(moduleDir, "mpr"), module);
|
|
|
|
System.out.println("生成模块:Manager");
|
|
|
|
System.out.println("生成模块:Manager");
|
|
|
|
generateManager(Tool.createPath(moduleDir.getAbsolutePath(), "mgr"), module);
|
|
|
|
generateManager(Tool.createPath(moduleDir, "mgr"), module);
|
|
|
|
System.out.println("生成模块:Request");
|
|
|
|
System.out.println("生成模块:Request");
|
|
|
|
generateRequest(Tool.createPath(moduleDir.getAbsolutePath(), "req"), module);
|
|
|
|
generateRequest(Tool.createPath(moduleDir, "req"), module);
|
|
|
|
System.out.println("生成模块:Response");
|
|
|
|
System.out.println("生成模块:Response");
|
|
|
|
generateResponse(Tool.createPath(moduleDir.getAbsolutePath(), "rsp"), module);
|
|
|
|
generateResponse(Tool.createPath(moduleDir, "rsp"), module);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -113,31 +114,35 @@ public class SpringBootCallable implements Callable {
|
|
|
|
module.setProjectAuthor(project.getProjectAuthor());
|
|
|
|
module.setProjectAuthor(project.getProjectAuthor());
|
|
|
|
module.setProjectBasePackage(project.getProjectBasePackage());
|
|
|
|
module.setProjectBasePackage(project.getProjectBasePackage());
|
|
|
|
module.setProjectName(project.getProjectName());
|
|
|
|
module.setProjectName(project.getProjectName());
|
|
|
|
File moduleDir = Tool.createPath(domainDir.getAbsolutePath(), "module", "system");
|
|
|
|
File moduleDir = Tool.createPath(domainDir, "module", "system");
|
|
|
|
generateSystemModule(moduleDir, module);
|
|
|
|
generateSystemModule(moduleDir, module);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// frame等内容
|
|
|
|
// frame等内容
|
|
|
|
System.out.println("生成模块:frame");
|
|
|
|
System.out.println("生成模块:frame");
|
|
|
|
generateFrame(Tool.createPath(domainDir.getAbsolutePath(), "frame"), project);
|
|
|
|
generateFrame(Tool.createPath(domainDir, "frame"), project);
|
|
|
|
|
|
|
|
|
|
|
|
// Task
|
|
|
|
// Task
|
|
|
|
System.out.println("生成模块:task");
|
|
|
|
System.out.println("生成模块:task");
|
|
|
|
generateTask(Tool.createPath(domainDir.getAbsolutePath(), "task"), project);
|
|
|
|
generateTask(Tool.createPath(domainDir, "task"), project);
|
|
|
|
|
|
|
|
|
|
|
|
// Application
|
|
|
|
// Application
|
|
|
|
System.out.println("生成模块:Application");
|
|
|
|
System.out.println("生成模块:Application");
|
|
|
|
generateApplication(Tool.createPath(domainDir.getAbsolutePath()), project);
|
|
|
|
generateApplication(Tool.createPath(domainDir), project);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{//生成resources文件
|
|
|
|
{//生成resources文件
|
|
|
|
System.out.println("生成模块:Resources");
|
|
|
|
System.out.println("生成模块:Resources");
|
|
|
|
generateResources(resourcesDir, project);
|
|
|
|
generateResources(resourcesDir, project);
|
|
|
|
System.out.println("生成模块:Static");
|
|
|
|
|
|
|
|
generateStatic(resourcesDir, project);
|
|
|
|
if (project.isNeedWeb()) {
|
|
|
|
System.out.println("生成模块:Templates");
|
|
|
|
System.out.println("生成模块:Static");
|
|
|
|
generateTemplates(resourcesDir, project);
|
|
|
|
generateStatic(resourcesDir, project);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("生成模块:Templates");
|
|
|
|
|
|
|
|
generateTemplates(resourcesDir, project);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{//生成Test
|
|
|
|
{//生成Test
|
|
|
@ -166,7 +171,7 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("dataBase", project.getDatabase().toString());
|
|
|
|
ctx.put("dataBase", project.getDatabase().toString());
|
|
|
|
ctx.put("project", project);
|
|
|
|
ctx.put("project", project);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "pom.xml"), "SpringBoot/pom.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "pom.xml"), "SpringBoot/pom.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -178,46 +183,51 @@ public class SpringBootCallable implements Callable {
|
|
|
|
public void generateController(File root, Project project) {
|
|
|
|
public void generateController(File root, Project project) {
|
|
|
|
Tool.clear(root);
|
|
|
|
Tool.clear(root);
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
ctx.put("project", project);
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("modules", project.getModules());
|
|
|
|
ctx.put("modules", project.getModules());
|
|
|
|
|
|
|
|
|
|
|
|
File control = Tool.createPath(root.getAbsolutePath(), "control");
|
|
|
|
if (project.isNeedWeb()) {
|
|
|
|
File screen = Tool.createPath(root.getAbsolutePath(), "screen");
|
|
|
|
File control = Tool.createPath(root, "control");
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(control.getAbsolutePath(), "Header.java"), "SpringBoot/java/action/control/Header.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(control, "Header.java"), "SpringBoot/java/action/control/Header.java", ctx);
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
File screen = Tool.createPath(root, "screen");
|
|
|
|
File ajax = Tool.createPath(root.getAbsolutePath(), "ajax");
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(screen, "Index.java"), "SpringBoot/java/action/screen/Index.java", ctx);
|
|
|
|
HashMap<String, Object> ctxss = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
ctxss.put("domain", project.getProjectBasePackage());
|
|
|
|
|
|
|
|
ctxss.put("author", project.getProjectAuthor());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Module module : project.getModules()) {
|
|
|
|
{// ajax 属于web内容
|
|
|
|
File m = Tool.createPath(ajax.getAbsolutePath(), module.getModuleName());
|
|
|
|
File ajax = Tool.createPath(root, "ajax");
|
|
|
|
ctxss.put("moduleName", module.getModuleName());
|
|
|
|
HashMap<String, Object> ctxss = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
ctxss.put("domain", project.getProjectBasePackage());
|
|
|
|
|
|
|
|
ctxss.put("author", project.getProjectAuthor());
|
|
|
|
|
|
|
|
|
|
|
|
for (Table table : module.getTables()) {
|
|
|
|
for (Module module : project.getModules()) {
|
|
|
|
if (table.getAjax()) {
|
|
|
|
File m = Tool.createPath(ajax, module.getModuleName());
|
|
|
|
ctxss.put("table", table);
|
|
|
|
ctxss.put("moduleName", module.getModuleName());
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Ajax.java"), "SpringBoot/java/action/ajax/Ajax.java", ctxss);
|
|
|
|
|
|
|
|
|
|
|
|
for (Table table : module.getTables()) {
|
|
|
|
|
|
|
|
if (table.getAjax()) {
|
|
|
|
|
|
|
|
ctxss.put("table", table);
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(m, table.getCName() + "Ajax.java"), "SpringBoot/java/action/ajax/Ajax.java", ctxss);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
File system = Tool.createPath(ajax.getAbsolutePath(), "system");
|
|
|
|
File system = Tool.createPath(ajax, "system");
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/action/ajax/system/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/action/ajax/system/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), name), "SpringBoot/java/action/ajax/system/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system, name), "SpringBoot/java/action/ajax/system/" + name, ctx);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (project.isNeedApi()) {
|
|
|
|
if (project.isNeedApi()) {
|
|
|
|
File api = Tool.createPath(root.getAbsolutePath(), "api");
|
|
|
|
File api = Tool.createPath(root, "api");
|
|
|
|
|
|
|
|
|
|
|
|
for (Module module : project.getModules()) {
|
|
|
|
for (Module module : project.getModules()) {
|
|
|
|
File m = Tool.createPath(api.getAbsolutePath(), module.getModuleName());
|
|
|
|
File m = Tool.createPath(api, module.getModuleName());
|
|
|
|
|
|
|
|
|
|
|
|
for (Table table : module.getTables()) {
|
|
|
|
for (Table table : module.getTables()) {
|
|
|
|
if (table.getApi()) {
|
|
|
|
if (table.getApi()) {
|
|
|
@ -226,21 +236,21 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctxss.put("module", module.getModuleName());
|
|
|
|
ctxss.put("module", module.getModuleName());
|
|
|
|
ctxss.put("author", project.getProjectAuthor());
|
|
|
|
ctxss.put("author", project.getProjectAuthor());
|
|
|
|
ctxss.put("table", table);
|
|
|
|
ctxss.put("table", table);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Api.java"), "SpringBoot/java/action/api/Api.java", ctxss);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(m, table.getCName() + "Api.java"), "SpringBoot/java/action/api/Api.java", ctxss);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
File system = Tool.createPath(api.getAbsolutePath(), "system");
|
|
|
|
File system = Tool.createPath(api, "system");
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/action/api/system/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/action/api/system/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), name), "SpringBoot/java/action/api/system/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system, name), "SpringBoot/java/action/api/system/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "Index.java"), "SpringBoot/java/action/screen/Index.java", ctx);
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "GlobalController.java"), "SpringBoot/java/action/GlobalController.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "GlobalController.java"), "SpringBoot/java/action/GlobalController.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void generateConfig(File root, Project project) {
|
|
|
|
public void generateConfig(File root, Project project) {
|
|
|
@ -255,21 +265,23 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
|
|
|
|
|
|
|
|
//config
|
|
|
|
//config
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ActionConfig.java"), "SpringBoot/java/config/ActionConfig.java", ctx);
|
|
|
|
if (project.isNeedWeb() || project.isNeedApi()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "CacheConfig.java"), "SpringBoot/java/config/CacheConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "ActionConfig.java"), "SpringBoot/java/config/ActionConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "FreeMarkerConfig.java"), "SpringBoot/java/config/FreeMarkerConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "FreeMarkerConfig.java"), "SpringBoot/java/config/FreeMarkerConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SecurityConfig.java"), "SpringBoot/java/config/SecurityConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "WebMvcConfig.java"), "SpringBoot/java/config/WebMvcConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "TaskConfig.java"), "SpringBoot/java/config/TaskConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "CacheConfig.java"), "SpringBoot/java/config/CacheConfig.java", ctx);
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "SecurityConfig.java"), "SpringBoot/java/config/SecurityConfig.java", ctx);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "TaskConfig.java"), "SpringBoot/java/config/TaskConfig.java", ctx);
|
|
|
|
if (project.isNeedAsync()) {
|
|
|
|
if (project.isNeedAsync()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ThreadPoolConfig.java"), "SpringBoot/java/config/ThreadPoolConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "ThreadPoolConfig.java"), "SpringBoot/java/config/ThreadPoolConfig.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "WebMvcConfig.java"), "SpringBoot/java/config/WebMvcConfig.java", ctx);
|
|
|
|
|
|
|
|
if (project.getDatabase().name().equals(DataBase.SQLite.name())) {
|
|
|
|
if (project.getDatabase().name().equals(DataBase.SQLite.name())) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SQLiteConfig.java"), "SpringBoot/java/config/SQLiteConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "SQLiteConfig.java"), "SpringBoot/java/config/SQLiteConfig.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (project.isNeedMoreDB()) {
|
|
|
|
if (project.isNeedMoreDB()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "MapperMainConfig.java"), "SpringBoot/java/config/MapperMainConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "MapperMainConfig.java"), "SpringBoot/java/config/MapperMainConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "MapperTwoConfig.java"), "SpringBoot/java/config/MapperTwoConfig.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "MapperTwoConfig.java"), "SpringBoot/java/config/MapperTwoConfig.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -294,7 +306,7 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
|
|
|
|
|
|
|
|
File file = Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + ".java");
|
|
|
|
File file = Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + ".java");
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/java/module/ent/entity.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/java/module/ent/entity.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -323,15 +335,15 @@ public class SpringBootCallable implements Callable {
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
if (table.getSys()) {
|
|
|
|
if (table.getSys()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".java"), "SpringBoot/java/module/mpr/Mapper.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".java"), "SpringBoot/java/module/mpr/Mapper.java", ctx);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".java"), "SpringBoot/java/module/mpr/Mapper_NSYS.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".java"), "SpringBoot/java/module/mpr/Mapper_NSYS.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getSys()) {
|
|
|
|
if (table.getSys()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".xml"), "SpringBoot/java/module/mpr/" + project.getDatabase().name() + "_mapper.xml", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".xml"), "SpringBoot/java/module/mpr/" + project.getDatabase().name() + "_mapper.xml", ctx);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".xml"), "SpringBoot/java/module/mpr/" + project.getDatabase().name() + "_NSYS_mapper.xml", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "Mapper" + ".xml"), "SpringBoot/java/module/mpr/" + project.getDatabase().name() + "_NSYS_mapper.xml", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -352,8 +364,8 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
|
|
|
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "Manager" + ".java"), "SpringBoot/java/module/mgr/manager.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "Manager" + ".java"), "SpringBoot/java/module/mgr/manager.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "ManagerImpl" + ".java"), "SpringBoot/java/module/mgr/managerImpl.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "ManagerImpl" + ".java"), "SpringBoot/java/module/mgr/managerImpl.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -381,27 +393,27 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getCreate()) {
|
|
|
|
if (table.getCreate()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "CreateRequest" + ".java"), "SpringBoot/java/module/req/createRequestClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "CreateRequest" + ".java"), "SpringBoot/java/module/req/createRequestClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getDelete()) {
|
|
|
|
if (table.getDelete()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "DeleteRequest" + ".java"), "SpringBoot/java/module/req/deleteRequestClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "DeleteRequest" + ".java"), "SpringBoot/java/module/req/deleteRequestClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getUpdate()) {
|
|
|
|
if (table.getUpdate()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "UpdateRequest" + ".java"), "SpringBoot/java/module/req/updateRequestClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "UpdateRequest" + ".java"), "SpringBoot/java/module/req/updateRequestClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getFind()) {
|
|
|
|
if (table.getFind()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "FindRequest" + ".java"), "SpringBoot/java/module/req/findRequestClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "FindRequest" + ".java"), "SpringBoot/java/module/req/findRequestClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getGet()) {
|
|
|
|
if (table.getGet()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "GetRequest" + ".java"), "SpringBoot/java/module/req/getRequestClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "GetRequest" + ".java"), "SpringBoot/java/module/req/getRequestClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getSearch()) {
|
|
|
|
if (table.getSearch()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "SearchRequest" + ".java"), "SpringBoot/java/module/req/searchRequestClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "SearchRequest" + ".java"), "SpringBoot/java/module/req/searchRequestClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -430,37 +442,37 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getCreate()) {
|
|
|
|
if (table.getCreate()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "CreateResponse" + ".java"), "SpringBoot/java/module/rsp/createResponseClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "CreateResponse" + ".java"), "SpringBoot/java/module/rsp/createResponseClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getDelete()) {
|
|
|
|
if (table.getDelete()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "DeleteResponse" + ".java"), "SpringBoot/java/module/rsp/deleteResponseClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "DeleteResponse" + ".java"), "SpringBoot/java/module/rsp/deleteResponseClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getUpdate()) {
|
|
|
|
if (table.getUpdate()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "UpdateResponse" + ".java"), "SpringBoot/java/module/rsp/updateResponseClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "UpdateResponse" + ".java"), "SpringBoot/java/module/rsp/updateResponseClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getFind()) {
|
|
|
|
if (table.getFind()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "FindResponse" + ".java"), "SpringBoot/java/module/rsp/findResponseClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "FindResponse" + ".java"), "SpringBoot/java/module/rsp/findResponseClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getGet()) {
|
|
|
|
if (table.getGet()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "GetResponse" + ".java"), "SpringBoot/java/module/rsp/getResponseClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "GetResponse" + ".java"), "SpringBoot/java/module/rsp/getResponseClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (table.getSearch()) {
|
|
|
|
if (table.getSearch()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "SearchResponse" + ".java"), "SpringBoot/java/module/rsp/searchResponseClass.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, Tool.ABB2Abb(table.getTableName()) + "SearchResponse" + ".java"), "SpringBoot/java/module/rsp/searchResponseClass.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void generateSystemModule(File root, Module md) {
|
|
|
|
public void generateSystemModule(File root, Module md) {
|
|
|
|
File ent = Tool.createPath(root.getAbsolutePath(), "ent");
|
|
|
|
File ent = Tool.createPath(root, "ent");
|
|
|
|
File mpr = Tool.createPath(root.getAbsolutePath(), "mpr");
|
|
|
|
File mpr = Tool.createPath(root, "mpr");
|
|
|
|
File mgr = Tool.createPath(root.getAbsolutePath(), "mgr");
|
|
|
|
File mgr = Tool.createPath(root, "mgr");
|
|
|
|
File req = Tool.createPath(root.getAbsolutePath(), "req");
|
|
|
|
File req = Tool.createPath(root, "req");
|
|
|
|
File rsp = Tool.createPath(root.getAbsolutePath(), "rsp");
|
|
|
|
File rsp = Tool.createPath(root, "rsp");
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
ctx.put("domain", md.getProjectBasePackage());
|
|
|
|
ctx.put("domain", md.getProjectBasePackage());
|
|
|
@ -469,29 +481,32 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("dataBase", project.getDatabase().toString());
|
|
|
|
ctx.put("dataBase", project.getDatabase().toString());
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/ent/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/ent/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), name), "SpringBoot/java/module/system/ent/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(ent, name), "SpringBoot/java/module/system/ent/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/mgr/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/mgr/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), name), "SpringBoot/java/module/system/mgr/" + name, ctx);
|
|
|
|
if (name.contains("TokensManager") && !project.isNeedWeb() && !project.isNeedApi()) {// 当不需要Web和Api时不需要处理Token问题
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(mgr, name), "SpringBoot/java/module/system/mgr/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/mpr/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/mpr/")) {
|
|
|
|
if (name.endsWith(".java")) {
|
|
|
|
if (name.endsWith(".java")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), name), "SpringBoot/java/module/system/mpr/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(mpr, name), "SpringBoot/java/module/system/mpr/" + name, ctx);
|
|
|
|
} else if (name.contains(project.getDatabase().name())) {
|
|
|
|
} else if (name.contains(project.getDatabase().name())) {
|
|
|
|
//todo dateBase调试
|
|
|
|
//todo dateBase调试
|
|
|
|
// freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), name), "SpringBoot/java/module/system/mpr/" + name, ctx);
|
|
|
|
// freeMarkerManager.outputTemp(Tool.createFile(mpr, name), "SpringBoot/java/module/system/mpr/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), name.replaceAll(project.getDatabase().name() + "_", "")), "SpringBoot/java/module/system/mpr/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(mpr, name.replaceAll(project.getDatabase().name() + "_", "")), "SpringBoot/java/module/system/mpr/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/req/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/req/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), name), "SpringBoot/java/module/system/req/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(req, name), "SpringBoot/java/module/system/req/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/rsp/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/rsp/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), name), "SpringBoot/java/module/system/rsp/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(rsp, name), "SpringBoot/java/module/system/rsp/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -512,51 +527,51 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("timestamp", new Date().getTime());
|
|
|
|
ctx.put("timestamp", new Date().getTime());
|
|
|
|
|
|
|
|
|
|
|
|
File auth = Tool.createPath(root.getAbsolutePath(), "auth");
|
|
|
|
File auth = Tool.createPath(root, "auth");
|
|
|
|
File base = Tool.createPath(root.getAbsolutePath(), "base");
|
|
|
|
File base = Tool.createPath(root, "base");
|
|
|
|
File excel = Tool.createPath(root.getAbsolutePath(), "excel");
|
|
|
|
File excel = Tool.createPath(root, "excel");
|
|
|
|
File excelannotation = Tool.createPath(excel.getAbsolutePath(), "annotation");
|
|
|
|
File excelannotation = Tool.createPath(excel, "annotation");
|
|
|
|
File excelconverter = Tool.createPath(excel.getAbsolutePath(), "converter");
|
|
|
|
File excelconverter = Tool.createPath(excel, "converter");
|
|
|
|
File exception = Tool.createPath(excel.getAbsolutePath(), "exception");
|
|
|
|
File exception = Tool.createPath(excel, "exception");
|
|
|
|
File excelhandler = Tool.createPath(excel.getAbsolutePath(), "handler");
|
|
|
|
File excelhandler = Tool.createPath(excel, "handler");
|
|
|
|
File excellistener = Tool.createPath(excel.getAbsolutePath(), "listener");
|
|
|
|
File excellistener = Tool.createPath(excel, "listener");
|
|
|
|
File schedule = Tool.createPath(root.getAbsolutePath(), "schedule");
|
|
|
|
File schedule = Tool.createPath(root, "schedule");
|
|
|
|
File utils = Tool.createPath(root.getAbsolutePath(), "utils");
|
|
|
|
File utils = Tool.createPath(root, "utils");
|
|
|
|
File validation = Tool.createPath(root.getAbsolutePath(), "validation");
|
|
|
|
File validation = Tool.createPath(root, "validation");
|
|
|
|
|
|
|
|
|
|
|
|
//auth
|
|
|
|
//auth
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/auth/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/auth/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(auth.getAbsolutePath(), name), "SpringBoot/java/frame/auth/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(auth, name), "SpringBoot/java/frame/auth/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//base
|
|
|
|
//base
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/base/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/base/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), name), "SpringBoot/java/frame/base/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(base, name), "SpringBoot/java/frame/base/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//excel
|
|
|
|
//excel
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), name), "SpringBoot/java/frame/excel/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excel, name), "SpringBoot/java/frame/excel/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/annotation/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/annotation/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), name), "SpringBoot/java/frame/excel/annotation/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excelannotation, name), "SpringBoot/java/frame/excel/annotation/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/converter/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/converter/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), name), "SpringBoot/java/frame/excel/converter/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excelconverter, name), "SpringBoot/java/frame/excel/converter/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/exception/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/exception/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), name), "SpringBoot/java/frame/excel/exception/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(exception, name), "SpringBoot/java/frame/excel/exception/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/handler/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/handler/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excelhandler.getAbsolutePath(), name), "SpringBoot/java/frame/excel/handler/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excelhandler, name), "SpringBoot/java/frame/excel/handler/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/listener/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/listener/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excellistener.getAbsolutePath(), name), "SpringBoot/java/frame/excel/listener/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(excellistener, name), "SpringBoot/java/frame/excel/listener/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//schedule
|
|
|
|
//schedule
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/schedule/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/schedule/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(schedule.getAbsolutePath(), name), "SpringBoot/java/frame/schedule/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(schedule, name), "SpringBoot/java/frame/schedule/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//utils
|
|
|
|
//utils
|
|
|
@ -566,16 +581,16 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
|
|
|
|
|
|
|
if (filters.contains(name)) {
|
|
|
|
if (filters.contains(name)) {
|
|
|
|
if (project.isNeedEMail()) {
|
|
|
|
if (project.isNeedEMail()) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), name), "SpringBoot/java/frame/utils/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(utils, name), "SpringBoot/java/frame/utils/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), name), "SpringBoot/java/frame/utils/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(utils, name), "SpringBoot/java/frame/utils/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//validation
|
|
|
|
//validation
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/validation/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/validation/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(validation.getAbsolutePath(), name), "SpringBoot/java/frame/validation/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(validation, name), "SpringBoot/java/frame/validation/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -598,7 +613,10 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
|
|
|
|
|
|
|
//task
|
|
|
|
//task
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/task/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/task/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), name), "SpringBoot/java/task/" + name, ctx);
|
|
|
|
if (name.contains("TokenTask") && !project.isNeedWeb() && !project.isNeedApi()) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, name), "SpringBoot/java/task/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -612,7 +630,7 @@ public class SpringBootCallable implements Callable {
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("project", project);
|
|
|
|
ctx.put("project", project);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "Application.java"), "SpringBoot/java/Application.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "Application.java"), "SpringBoot/java/Application.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -632,15 +650,15 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("projectName", project.getProjectName());
|
|
|
|
ctx.put("projectName", project.getProjectName());
|
|
|
|
ctx.put("project", project);
|
|
|
|
ctx.put("project", project);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "start-dev.bat"), "SpringBoot/resources/start-dev.bat", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "start-dev.bat"), "SpringBoot/resources/start-dev.bat", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "start-prod.bat"), "SpringBoot/resources/start-prod.bat", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "start-prod.bat"), "SpringBoot/resources/start-prod.bat", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application.properties"), "SpringBoot/resources/application.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "application.properties"), "SpringBoot/resources/application.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application-dev.properties"), "SpringBoot/resources/application-dev.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "application-dev.properties"), "SpringBoot/resources/application-dev.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application-prod.properties"), "SpringBoot/resources/application-prod.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "application-prod.properties"), "SpringBoot/resources/application-prod.ftl", ctx);
|
|
|
|
Tool.outputResource("SpringBoot/resources/logback-spring-dev.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring-dev.xml"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/logback-spring-dev.xml", Tool.createFile(root, "logback-spring-dev.xml"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/logback-spring-prod.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring-prod.xml"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/logback-spring-prod.xml", Tool.createFile(root, "logback-spring-prod.xml"));
|
|
|
|
|
|
|
|
|
|
|
|
File dbtool = Tool.createPath(root.getAbsolutePath(), "dbtool");
|
|
|
|
File dbtool = Tool.createPath(root, "dbtool");
|
|
|
|
{
|
|
|
|
{
|
|
|
|
XmlManager xmlManager = ManagerFactory.getXmlManager();
|
|
|
|
XmlManager xmlManager = ManagerFactory.getXmlManager();
|
|
|
|
xmlManager.saveAs(dbtool, project);
|
|
|
|
xmlManager.saveAs(dbtool, project);
|
|
|
@ -649,36 +667,36 @@ public class SpringBootCallable implements Callable {
|
|
|
|
for (Module module : project.getModules()) {
|
|
|
|
for (Module module : project.getModules()) {
|
|
|
|
ctx.put("moduleName", module.getModuleName());
|
|
|
|
ctx.put("moduleName", module.getModuleName());
|
|
|
|
ctx.put("module", module);
|
|
|
|
ctx.put("module", module);
|
|
|
|
File tableDir = Tool.createPath(dbtool.getAbsolutePath(), module.getModuleName() + "_table");
|
|
|
|
File tableDir = Tool.createPath(dbtool, module.getModuleName() + "_table");
|
|
|
|
for (Table table : module.getTables()) {
|
|
|
|
for (Table table : module.getTables()) {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), project.getDatabase().name() + "_" + table.getTableName() + ".sql"), "SpringBoot/resources/dbtool/table.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(tableDir, project.getDatabase().name() + "_" + table.getTableName() + ".sql"), "SpringBoot/resources/dbtool/table.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), project.getDatabase().name() + "_ALL_TABLE" + ".sql"), "SpringBoot/resources/dbtool/tableAll.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(tableDir, project.getDatabase().name() + "_ALL_TABLE" + ".sql"), "SpringBoot/resources/dbtool/tableAll.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
File system = Tool.createPath(dbtool.getAbsolutePath(), "system_table");
|
|
|
|
File system = Tool.createPath(dbtool, "system_table");
|
|
|
|
|
|
|
|
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/resources/dbtool/system/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/resources/dbtool/system/")) {
|
|
|
|
if (name.contains(project.getDatabase().name())) {
|
|
|
|
if (name.contains(project.getDatabase().name())) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), name), "SpringBoot/resources/dbtool/system/" + name, ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system, name), "SpringBoot/resources/dbtool/system/" + name, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if (DataBase.Oracle.name().equals(project.getDatabase().name())) {
|
|
|
|
// if (DataBase.Oracle.name().equals(project.getDatabase().name())) {
|
|
|
|
// File lib = Tool.createPath(root.getAbsolutePath(), "lib");
|
|
|
|
// File lib = Tool.createPath(root, "lib");
|
|
|
|
// Tool.outputResource("SpringBoot/resources/lib/ojdbc7-12.1.0.2.jar", Tool.createFile(lib.getAbsolutePath(), "ojdbc7-12.1.0.2.jar"));
|
|
|
|
// Tool.outputResource("SpringBoot/resources/lib/ojdbc7-12.1.0.2.jar", Tool.createFile(lib, "ojdbc7-12.1.0.2.jar"));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if (DataBase.SQLite.name().equals(project.getDatabase().name())) {
|
|
|
|
if (DataBase.SQLite.name().equals(project.getDatabase().name())) {
|
|
|
|
File dbFile = Tool.createFile(root.getAbsolutePath(), project.getProjectName() + ".db3");
|
|
|
|
File dbFile = Tool.createFile(root, project.getProjectName() + ".db3");
|
|
|
|
Connection connection = null;
|
|
|
|
Connection connection = null;
|
|
|
|
Statement statement = null;
|
|
|
|
Statement statement = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Class.forName("org.sqlite.JDBC");
|
|
|
|
Class.forName("org.sqlite.JDBC");
|
|
|
|
connection = DriverManager.getConnection("jdbc:sqlite:" + dbFile.getAbsolutePath());
|
|
|
|
connection = DriverManager.getConnection("jdbc:sqlite:" + dbFile);
|
|
|
|
|
|
|
|
|
|
|
|
for (File fileModule : dbtool.listFiles()) {
|
|
|
|
for (File fileModule : dbtool.listFiles()) {
|
|
|
|
if (!fileModule.isDirectory()) {
|
|
|
|
if (!fileModule.isDirectory()) {
|
|
|
@ -716,8 +734,8 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("dBmapper", dBmapper);
|
|
|
|
ctx.put("dBmapper", dBmapper);
|
|
|
|
ctx.put("project", project);
|
|
|
|
ctx.put("project", project);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application.properties"), "SpringBoot/test/application.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "application.properties"), "SpringBoot/test/application.ftl", ctx);
|
|
|
|
Tool.outputResource("SpringBoot/test/logback-spring.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring.xml"));
|
|
|
|
Tool.outputResource("SpringBoot/test/logback-spring.xml", Tool.createFile(root, "logback-spring.xml"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -734,35 +752,35 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("modules", project.getModules());
|
|
|
|
ctx.put("modules", project.getModules());
|
|
|
|
|
|
|
|
|
|
|
|
File static_ = Tool.createPath(root.getAbsolutePath(), "static");
|
|
|
|
File static_ = Tool.createPath(root, "static");
|
|
|
|
File css = Tool.createPath(static_.getAbsolutePath(), "css");
|
|
|
|
File css = Tool.createPath(static_, "css");
|
|
|
|
File img = Tool.createPath(static_.getAbsolutePath(), "img");
|
|
|
|
File img = Tool.createPath(static_, "img");
|
|
|
|
File dist = Tool.createPath(static_.getAbsolutePath(), "dist");
|
|
|
|
File dist = Tool.createPath(static_, "dist");
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/favicon.ico", Tool.createFile(static_.getAbsolutePath(), "favicon.ico"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/favicon.ico", Tool.createFile(static_, "favicon.ico"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{//css文件
|
|
|
|
{//css文件
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(css.getAbsolutePath(), "base.css"), "SpringBoot/resources/static/css/base.css", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(css, "base.css"), "SpringBoot/resources/static/css/base.css", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{//img
|
|
|
|
{//img
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/img/logo.png", Tool.createFile(img.getAbsolutePath(), "logo.png"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/img/logo.png", Tool.createFile(img, "logo.png"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{//dist文件
|
|
|
|
{//dist文件
|
|
|
|
//jquery + vue + vue-router + axios
|
|
|
|
//jquery + vue + vue-router + axios
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/lib.min.js", Tool.createFile(dist.getAbsolutePath(), "lib.min.js"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/lib.min.js", Tool.createFile(dist, "lib.min.js"));
|
|
|
|
|
|
|
|
|
|
|
|
//element-ui
|
|
|
|
//element-ui
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/index.min.js", Tool.createFile(dist.getAbsolutePath(), "index.min.js"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/index.min.js", Tool.createFile(dist, "index.min.js"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/index.min.css", Tool.createFile(dist.getAbsolutePath(), "index.min.css"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/index.min.css", Tool.createFile(dist, "index.min.css"));
|
|
|
|
|
|
|
|
|
|
|
|
File fonts = Tool.createPath(dist.getAbsolutePath(), "fonts");
|
|
|
|
File fonts = Tool.createPath(dist, "fonts");
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/fonts/w-e-icon.woff", Tool.createFile(fonts.getAbsolutePath(), "w-e-icon.woff"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/fonts/w-e-icon.woff", Tool.createFile(fonts, "w-e-icon.woff"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/fonts/element-icons.woff", Tool.createFile(fonts.getAbsolutePath(), "element-icons.woff"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/fonts/element-icons.woff", Tool.createFile(fonts, "element-icons.woff"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/fonts/element-icons.ttf", Tool.createFile(fonts.getAbsolutePath(), "element-icons.ttf"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/static/dist/fonts/element-icons.ttf", Tool.createFile(fonts, "element-icons.ttf"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -775,18 +793,18 @@ public class SpringBootCallable implements Callable {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void generateTemplates(File root, Project project) {
|
|
|
|
public void generateTemplates(File root, Project project) {
|
|
|
|
{//生成
|
|
|
|
{//生成
|
|
|
|
File templates = Tool.createPath(root.getAbsolutePath(), "templates");
|
|
|
|
File templates = Tool.createPath(root, "templates");
|
|
|
|
File control = Tool.createPath(templates.getAbsolutePath(), "control");
|
|
|
|
File control = Tool.createPath(templates, "control");
|
|
|
|
File layout = Tool.createPath(templates.getAbsolutePath(), "layout");
|
|
|
|
File layout = Tool.createPath(templates, "layout");
|
|
|
|
File screen = Tool.createPath(templates.getAbsolutePath(), "screen");
|
|
|
|
File screen = Tool.createPath(templates, "screen");
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/control/nav.ftl", Tool.createFile(control.getAbsolutePath(), "nav.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/control/nav.ftl", Tool.createFile(control, "nav.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/control/macro.ftl", Tool.createFile(control.getAbsolutePath(), "macro.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/control/macro.ftl", Tool.createFile(control, "macro.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/layout/default.ftl", Tool.createFile(layout.getAbsolutePath(), "default.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/layout/default.ftl", Tool.createFile(layout, "default.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/screen/home.ftl", Tool.createFile(screen.getAbsolutePath(), "home.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/screen/home.ftl", Tool.createFile(screen, "home.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/screen/login.ftl", Tool.createFile(screen.getAbsolutePath(), "login.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/screen/login.ftl", Tool.createFile(screen, "login.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/403.ftl", Tool.createFile(templates.getAbsolutePath(), "403.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/403.ftl", Tool.createFile(templates, "403.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/404.ftl", Tool.createFile(templates.getAbsolutePath(), "404.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/404.ftl", Tool.createFile(templates, "404.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/500.ftl", Tool.createFile(templates.getAbsolutePath(), "500.ftl"));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/500.ftl", Tool.createFile(templates, "500.ftl"));
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
@ -795,14 +813,14 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("modules", project.getModules());
|
|
|
|
ctx.put("modules", project.getModules());
|
|
|
|
ctx.put("sysMD", project.isNeedSys());
|
|
|
|
ctx.put("sysMD", project.isNeedSys());
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "index.ftl"), "SpringBoot/resources/templates/screen/index.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(screen, "index.ftl"), "SpringBoot/resources/templates/screen/index.ftl", ctx);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Module mo : project.getModules()) {
|
|
|
|
for (Module mo : project.getModules()) {
|
|
|
|
for (Table table : mo.getTables()) {
|
|
|
|
for (Table table : mo.getTables()) {
|
|
|
|
if (table.getHtml()) {
|
|
|
|
if (table.getHtml()) {
|
|
|
|
File module = Tool.createPath(screen.getAbsolutePath(), mo.getModuleName());
|
|
|
|
File module = Tool.createPath(screen, mo.getModuleName());
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("tool", Tool.class);
|
|
|
|
ctx.put("tool", Tool.class);
|
|
|
@ -810,16 +828,16 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("module", module);
|
|
|
|
ctx.put("module", module);
|
|
|
|
ctx.put("fields", table.getFields());
|
|
|
|
ctx.put("fields", table.getFields());
|
|
|
|
File file = Tool.createFile(module.getAbsolutePath(), table.getFName() + ".ftl");
|
|
|
|
File file = Tool.createFile(module, table.getFName() + ".ftl");
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/resources/templates/screen/module/mgr.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/resources/templates/screen/module/mgr.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
if (project.isNeedSys()) {//生成系统模块
|
|
|
|
File system = Tool.createPath(screen.getAbsolutePath(), "system");
|
|
|
|
File system = Tool.createPath(screen, "system");
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/resources/templates/screen/module/system/")) {
|
|
|
|
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/resources/templates/screen/module/system/")) {
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/screen/module/system/" + name, Tool.createFile(system.getAbsolutePath(), name));
|
|
|
|
Tool.outputResource("SpringBoot/resources/templates/screen/module/system/" + name, Tool.createFile(system, name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -828,14 +846,14 @@ public class SpringBootCallable implements Callable {
|
|
|
|
public void generateTest(File root, Project project) {
|
|
|
|
public void generateTest(File root, Project project) {
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
File config = Tool.createPath(root.getAbsolutePath(), "config");
|
|
|
|
File config = Tool.createPath(root, "config");
|
|
|
|
config.mkdirs();
|
|
|
|
config.mkdirs();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
ctx.put("tool", Tool.class);
|
|
|
|
ctx.put("tool", Tool.class);
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
File file = Tool.createFile(config.getAbsolutePath(), "TestConfig" + ".java");
|
|
|
|
File file = Tool.createFile(config, "TestConfig" + ".java");
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/test/TestConfig.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/test/TestConfig.ftl", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -845,25 +863,27 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
File file = Tool.createFile(root.getAbsolutePath(), "UtilTest" + ".java");
|
|
|
|
File file = Tool.createFile(root, "UtilTest" + ".java");
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/test/UtilTest.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/test/UtilTest.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Module md : project.getModules()) {
|
|
|
|
for (Module md : project.getModules()) {
|
|
|
|
File module = Tool.createPath(root.getAbsolutePath(), md.getModuleName());
|
|
|
|
if (md.getNeedGenerate()) {
|
|
|
|
|
|
|
|
File module = Tool.createPath(root, md.getModuleName());
|
|
|
|
|
|
|
|
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("module", md);
|
|
|
|
ctx.put("module", md);
|
|
|
|
ctx.put("moduleName", md.getModuleName());
|
|
|
|
ctx.put("moduleName", md.getModuleName());
|
|
|
|
ctx.put("tool", Tool.class);
|
|
|
|
ctx.put("tool", Tool.class);
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("table", table);
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
|
|
|
|
|
|
|
|
File file = Tool.createFile(module.getAbsolutePath(), Tool.ABB2Abb(table.getTableName()) + "Test" + ".java");
|
|
|
|
File file = Tool.createFile(module, Tool.ABB2Abb(table.getTableName()) + "Test" + ".java");
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/test/test.ftl", ctx);
|
|
|
|
freeMarkerManager.outputTemp(file, "SpringBoot/test/test.ftl", ctx);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -873,10 +893,13 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("domain", project.getProjectBasePackage());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("moduleName", project.getProjectName());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
File system = Tool.createPath(root.getAbsolutePath(), "system");
|
|
|
|
File system = Tool.createPath(root, "system");
|
|
|
|
|
|
|
|
|
|
|
|
for (String apiFile : ResourceUtil.getResourceFiles("/modules/SpringBoot/test/system/")) {
|
|
|
|
for (String apiFile : ResourceUtil.getResourceFiles("/modules/SpringBoot/test/system/")) {
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), apiFile), "SpringBoot/test/system/" + apiFile, ctx);
|
|
|
|
if (apiFile.contains("TokensTest") && !project.isNeedWeb() && !project.isNeedApi()) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(system, apiFile), "SpringBoot/test/system/" + apiFile, ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -888,7 +911,7 @@ public class SpringBootCallable implements Callable {
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("author", project.getProjectAuthor());
|
|
|
|
ctx.put("project", project);
|
|
|
|
ctx.put("project", project);
|
|
|
|
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "DataInit.java"), "SpringBoot/test/DataInit.java", ctx);
|
|
|
|
freeMarkerManager.outputTemp(Tool.createFile(root, "DataInit.java"), "SpringBoot/test/DataInit.java", ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|