Api模块独立

master
wangbing 6 years ago
parent 9004da1363
commit c4248e604d

@ -104,6 +104,30 @@ public class SpringBootCallable implements Callable {
//module //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()) { for (Module module : project.getModules()) {
module.setProjectAuthor(project.getProjectAuthor()); module.setProjectAuthor(project.getProjectAuthor());
module.setProjectBasePackage(project.getProjectBasePackage()); 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); 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) { public void generateConfig(File root, Project project, DataBase dataBase, String option) {
if (!root.exists()) { if (!root.exists()) {
root.mkdirs(); root.mkdirs();
@ -322,8 +347,10 @@ public class SpringBootCallable implements Callable {
ctx.put("author", md.getProjectAuthor()); ctx.put("author", md.getProjectAuthor());
ctx.put("date", new Date()); ctx.put("date", new Date());
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(), "ApiManager" + ".java"), option + "/java/mgr/ApiManager.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManagerImpl" + ".java"), option + "/java/mgr/ApiManagerImpl.java", ctx); freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiManagerImpl" + ".java"), option + "/java/mgr/ApiManagerImpl.java", ctx);
}
for (Table table : md.getTables()) { for (Table table : md.getTables()) {
ctx.put("table", table); ctx.put("table", table);
@ -352,7 +379,10 @@ public class SpringBootCallable implements Callable {
ctx.put("moduleName", md.getModuleName()); ctx.put("moduleName", md.getModuleName());
ctx.put("author", md.getProjectAuthor()); ctx.put("author", md.getProjectAuthor());
ctx.put("date", new Date()); ctx.put("date", new Date());
if (md.getModuleName().equals("api")) {
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleRequest" + ".java"), option + "/java/req/ApiExampleRequest.java", ctx); freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleRequest" + ".java"), option + "/java/req/ApiExampleRequest.java", ctx);
}
for (Table table : md.getTables()) { for (Table table : md.getTables()) {
ctx.put("table", table); ctx.put("table", table);
@ -405,7 +435,10 @@ public class SpringBootCallable implements Callable {
ctx.put("moduleName", md.getModuleName()); ctx.put("moduleName", md.getModuleName());
ctx.put("author", md.getProjectAuthor()); ctx.put("author", md.getProjectAuthor());
ctx.put("date", new Date()); ctx.put("date", new Date());
if (md.getModuleName().equals("api")) {
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleResponse" + ".java"), option + "/java/rsp/ApiExampleResponse.java", ctx); freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ApiExampleResponse" + ".java"), option + "/java/rsp/ApiExampleResponse.java", ctx);
}
for (Table table : md.getTables()) { for (Table table : md.getTables()) {
ctx.put("table", table); ctx.put("table", table);

Loading…
Cancel
Save

Powered by TurnKey Linux.