|
|
|
@ -28,7 +28,7 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
|
|
|
|
|
private FreeMarkerManager freeMarkerManager;
|
|
|
|
|
|
|
|
|
|
public SpringBootCallable(String root, DataBase dataBase, Project project, String option,boolean cloud) {
|
|
|
|
|
public SpringBootCallable(String root, DataBase dataBase, Project project, String option, boolean cloud) {
|
|
|
|
|
this.root = root;
|
|
|
|
|
this.dataBase = dataBase;
|
|
|
|
|
this.project = project;
|
|
|
|
@ -104,6 +104,30 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
|
|
|
|
|
//module
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Module module = new Module();
|
|
|
|
|
File api = new File(src.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("生成模块:Enums");
|
|
|
|
|
generateEnums(new File(api.getAbsolutePath(), "enums"), 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");
|
|
|
|
|
generateRequset(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()) {
|
|
|
|
|
module.setProjectAuthor(project.getProjectAuthor());
|
|
|
|
|
module.setProjectBasePackage(project.getProjectBasePackage());
|
|
|
|
@ -207,6 +231,7 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "AjaxController.java"), option + "/java/action/AjaxController.ftl", ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void generateConfig(File root, Project project, DataBase dataBase, String option) {
|
|
|
|
|
if (!root.exists()) {
|
|
|
|
|
root.mkdirs();
|
|
|
|
@ -322,8 +347,10 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
|
ctx.put("date", new Date());
|
|
|
|
|
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManager" + ".java"), option + "/java/mgr/ApiManager.java", ctx);
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManagerImpl" + ".java"), option + "/java/mgr/ApiManagerImpl.java", ctx);
|
|
|
|
|
if (md.getModuleName().equals("api")) {
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManager" + ".java"), option + "/java/mgr/ApiManager.java", ctx);
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManagerImpl" + ".java"), option + "/java/mgr/ApiManagerImpl.java", ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
|
ctx.put("table", table);
|
|
|
|
@ -352,7 +379,10 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
ctx.put("moduleName", md.getModuleName());
|
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
|
ctx.put("date", new Date());
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleRequest" + ".java"), option + "/java/req/ApiExampleRequest.java", ctx);
|
|
|
|
|
|
|
|
|
|
if (md.getModuleName().equals("api")) {
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleRequest" + ".java"), option + "/java/req/ApiExampleRequest.java", ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
|
ctx.put("table", table);
|
|
|
|
@ -405,7 +435,10 @@ public class SpringBootCallable implements Callable {
|
|
|
|
|
ctx.put("moduleName", md.getModuleName());
|
|
|
|
|
ctx.put("author", md.getProjectAuthor());
|
|
|
|
|
ctx.put("date", new Date());
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleResponse" + ".java"), option + "/java/rsp/ApiExampleResponse.java", ctx);
|
|
|
|
|
|
|
|
|
|
if (md.getModuleName().equals("api")) {
|
|
|
|
|
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleResponse" + ".java"), option + "/java/rsp/ApiExampleResponse.java", ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Table table : md.getTables()) {
|
|
|
|
|
ctx.put("table", table);
|
|
|
|
|