@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.Date ;
import java.util.Date ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.concurrent.Callable ;
import java.util.concurrent.Callable ;
import java.util.regex.Pattern ;
public class SpringBootCallable implements Callable {
public class SpringBootCallable implements Callable {
@ -62,81 +61,41 @@ public class SpringBootCallable implements Callable {
// 生成资源目录
// 生成资源目录
File resourcesDir = Tool . createPath ( dir , "src" , "main" , "resources" ) ;
File resourcesDir = Tool . createPath ( dir , "src" , "main" , "resources" ) ;
// 生成域名目录
// 生成域名目录
File domainDir = javaDir ;
File domainDir = Tool . createPath ( javaDir , project . getDomain ( ) . split ( "\\." ) ) ;
for ( String s : project . getDomain ( ) . split ( "\\." ) ) {
domainDir = Tool . createPath ( domainDir , s ) ;
}
// 生成单元测试java目录
// 生成单元测试java目录
File testJavaDir = Tool . createPath ( dir , "src" , "test" , "java" ) ;
File testJavaDir = Tool . createPath ( dir , "src" , "test" , "java" ) ;
File testDomainDir = testJavaDir ;
// 生成单元测试域名目录
for ( String s : project . getDomain ( ) . split ( "\\." ) ) {
File testDomainDir = Tool . createPath ( testJavaDir , project . getDomain ( ) . split ( "\\." ) ) ;
testDomainDir = Tool . createPath ( testDomainDir , s ) ;
}
// 生成单元测试resources目录
// 生成单元测试resources目录
File testResourcesDir = Tool . createPath ( dir , "src" , "test" , "resources" ) ;
File testResourcesDir = Tool . createPath ( dir , "src" , "test" , "resources" ) ;
// 生成POM
// 生成POM
generatePom ( dir , project ) ;
generatePom ( dir , project ) ;
// 生成Application
// Application
System . out . println ( "生成模块:Application" ) ;
System . out . println ( "生成模块:Application" ) ;
generateApplication ( Tool . createPath ( domainDir ) , project ) ;
generateApplication ( Tool . createPath ( domainDir ) , project ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) { //生成java文件
System . out . println ( "生成模块:action" ) ;
//生成 Controller
generateController ( Tool . createPath ( domainDir , "action" ) , project ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
System . out . println ( "生成模块:config" ) ;
System . out . println ( "生成模块:action" ) ;
generateConfig ( Tool . createPath ( domainDir , "config" ) , project ) ;
generateController ( Tool . createPath ( domainDir , "action" ) , project ) ;
System . out . println ( "生成模块:frame" ) ;
}
generateFrame ( Tool . createPath ( domainDir , "frame" ) , project ) ;
System . out . println ( "生成模块:module" ) ;
// 生成 Config
generateModule ( Tool . createPath ( domainDir , "module" ) , project ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
System . out . println ( "生成模块:task" ) ;
System . out . println ( "生成模块:config" ) ;
generateTask ( Tool . createPath ( domainDir , "task" ) , project ) ;
generateConfig ( Tool . createPath ( domainDir , "config" ) , project ) ;
}
// 模块
generateResources_template ( resourcesDir , project ) ;
generateModule ( Tool . createPath ( domainDir , "module" ) , project ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
generateModuleFor 服 务 框 架 ( Tool . createPath ( domainDir , "module" ) , project ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
generateModuleFor 接 口 框 架 ( Tool . createPath ( domainDir , "module" ) , project ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
generateModuleFor 网 页 框 架 ( Tool . createPath ( domainDir , "module" ) , project ) ;
}
// frame等内容
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
System . out . println ( "生成模块:frame" ) ;
generateFrame ( Tool . createPath ( domainDir , "frame" ) , project ) ;
}
// Task
System . out . println ( "生成模块:task" ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
generateTask ( Tool . createPath ( domainDir , "task" ) , project ) ;
}
}
generateModuleForSys ( Tool . createPath ( domainDir , "module" ) , project ) ;
//生成resources文件
//生成resources文件
generateResources ( resourcesDir , project ) ;
generateResources ( resourcesDir , project ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
System . out . println ( "生成模块:Test" ) ;
{ //生成Test
generateTest ( testDomainDir , project ) ;
System . out . println ( "生成模块:Test" ) ;
System . out . println ( "生成模块:Test Resources" ) ;
generateTest ( testDomainDir , project ) ;
generateTestResources ( testResourcesDir , project ) ;
}
{ //生成Test Resources
System . out . println ( "生成模块:Test Resources" ) ;
generateTestResources ( testResourcesDir , project ) ;
}
}
System . out . println ( "finish" ) ;
System . out . println ( "finish" ) ;
return true ;
return true ;
@ -172,41 +131,34 @@ public class SpringBootCallable implements Callable {
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "modules" , project . getModules ( ) ) ;
ctx . put ( "modules" , project . getModules ( ) ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
File control = Tool . createPath ( root , "control" ) ;
File control = Tool . createPath ( root , "control" ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( control , "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 screen = Tool . createPath ( root , "screen" ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( screen , "Index.java" ) , "SpringBoot/java/action/screen/Index.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( screen , "Index.java" ) , "SpringBoot/java/action/screen/Index.java" , ctx ) ;
{ // ajax 属于web内容
{ // ajax 属于web内容
File ajax = Tool . createPath ( root , "ajax" ) ;
File ajax = Tool . createPath ( root , "ajax" ) ;
HashMap < String , Object > ctxss = new HashMap < String , Object > ( ) ;
HashMap < String , Object > ctxss = new HashMap < String , Object > ( ) ;
ctxss . put ( "domain" , project . getDomain ( ) ) ;
ctxss . put ( "domain" , project . getDomain ( ) ) ;
ctxss . put ( "author" , project . getAuthor ( ) ) ;
ctxss . put ( "author" , project . getAuthor ( ) ) ;
for ( Module module : project . getModules ( ) ) {
for ( Module module : project . getModules ( ) ) {
File m = Tool . createPath ( ajax , module . getModuleName ( ) ) ;
File m = Tool . createPath ( ajax , module . getModuleName ( ) ) ;
ctxss . put ( "moduleName" , module . getModuleName ( ) ) ;
ctxss . put ( "moduleName" , module . getModuleName ( ) ) ;
for ( Table table : module . getTables ( ) ) {
for ( Table table : module . getTables ( ) ) {
if ( table . getAjax ( ) ) {
if ( table . getAjax ( ) ) {
ctxss . put ( "table" , table ) ;
ctxss . put ( "table" , table ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( m , table . getCName ( ) + "Ajax.java" ) , "SpringBoot/java/action/ajax/Ajax.java" , ctxss ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( m , table . getCName ( ) + "Ajax.java" ) , "SpringBoot/java/action/ajax/Ajax.java" , ctxss ) ;
}
}
}
}
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) { //生成系统模块
if ( project . getFrame ( ) . value ( ) = = Frame . 管 理 框 架 . value ( ) ) { //管理架构
File wsys = Tool . createPath ( ajax , "wsys" ) ;
File wsys = Tool . createPath ( ajax , "wsys" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/ajax/wsys/" ) ) {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/ajax/wsys/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , name ) , "SpringBoot/java/action/ajax/wsys/" + name , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , name ) , "SpringBoot/java/action/ajax/wsys/" + name , ctx ) ;
}
File wsvr = Tool . createPath ( ajax , "wsvr" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/ajax/wsvr/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsvr , name ) , "SpringBoot/java/action/ajax/wsvr/" + name , ctx ) ;
}
}
}
}
}
}
}
@ -229,7 +181,7 @@ public class SpringBootCallable implements Callable {
}
}
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网页 框 架 . value ( ) ) { //生成系统模块
if ( project . getFrame ( ) . value ( ) > = Frame . 管理 框 架 . value ( ) ) { //生成系统模块
File wsys = Tool . createPath ( api , "wsys" ) ;
File wsys = Tool . createPath ( api , "wsys" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/api/wsys/" ) ) {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/action/api/wsys/" ) ) {
@ -254,18 +206,12 @@ public class SpringBootCallable implements Callable {
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
//config
//config
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "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 , "WebMvcConfig.java" ) , "SpringBoot/java/config/WebMvcConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "WebMvcConfig.java" ) , "SpringBoot/java/config/WebMvcConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "CacheConfig.java" ) , "SpringBoot/java/config/CacheConfig.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 , "SecurityConfig.java" ) , "SpringBoot/java/config/SecurityConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ActionConfig.java" ) , "SpringBoot/java/config/ActionConfig.java" , ctx ) ;
}
freeMarkerManager . outputTemp ( Tool . createFile ( root , "TaskConfig.java" ) , "SpringBoot/java/config/TaskConfig.java" , ctx ) ;
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ActionConfig.java" ) , "SpringBoot/java/config/ActionConfig.java" , ctx ) ;
}
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "TaskConfig.java" ) , "SpringBoot/java/config/TaskConfig.java" , ctx ) ;
}
if ( project . isNeedAsync ( ) ) {
if ( project . isNeedAsync ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ThreadPoolConfig.java" ) , "SpringBoot/java/config/ThreadPoolConfig.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ThreadPoolConfig.java" ) , "SpringBoot/java/config/ThreadPoolConfig.java" , ctx ) ;
}
}
@ -360,88 +306,7 @@ public class SpringBootCallable implements Callable {
}
}
}
}
public void generateModuleFor 服 务 框 架 ( File root , Project project ) {
public void generateModuleForSys ( File root , Project project ) {
Module wsvrModule = tryGetModule ( project , "wsvr" ) ;
if ( wsvrModule = = null | | ! wsvrModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "project" , project ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "dataBase" , project . getDatabase ( ) . toString ( ) ) ;
File ent = Tool . createPath ( root , "wsvr" , "ent" ) ;
File mpr = Tool . createPath ( root , "wsvr" , "mpr" ) ;
File mgr = Tool . createPath ( root , "wsvr" , "mgr" ) ;
File req = Tool . createPath ( root , "wsvr" , "req" ) ;
File rsp = Tool . createPath ( root , "wsvr" , "rsp" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/ent/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( ent , name ) , "SpringBoot/java/module/wsvr/ent/" + name , ctx ) ;
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/mgr/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsvr/mgr/" + name , ctx ) ;
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/mpr/" ) ) {
if ( name . endsWith ( ".java" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name ) , "SpringBoot/java/module/wsvr/mpr/" + name , ctx ) ;
} else if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name . replaceAll ( project . getDatabase ( ) . name ( ) + "_" , "" ) ) , "SpringBoot/java/module/wsvr/mpr/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/req/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( req , name ) , "SpringBoot/java/module/wsvr/req/" + name , ctx ) ;
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsvr/rsp/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( rsp , name ) , "SpringBoot/java/module/wsvr/rsp/" + name , ctx ) ;
}
}
}
public void generateModuleFor 接 口 框 架 ( File root , Project project ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ;
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "project" , project ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "dataBase" , project . getDatabase ( ) . toString ( ) ) ;
File ent = Tool . createPath ( root , "wsys" , "ent" ) ;
File mpr = Tool . createPath ( root , "wsys" , "mpr" ) ;
File mgr = Tool . createPath ( root , "wsys" , "mgr" ) ;
File req = Tool . createPath ( root , "wsys" , "req" ) ;
File rsp = Tool . createPath ( root , "wsys" , "rsp" ) ;
Pattern compile = Pattern . compile ( "Dict.*" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/ent/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( ent , name ) , "SpringBoot/java/module/wsys/ent/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mgr/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsys/mgr/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mpr/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
if ( name . endsWith ( ".java" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name ) , "SpringBoot/java/module/wsys/mpr/" + name , ctx ) ;
} else if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( mpr , name . replaceAll ( project . getDatabase ( ) . name ( ) + "_" , "" ) ) , "SpringBoot/java/module/wsys/mpr/" + name , ctx ) ;
}
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/req/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( req , name ) , "SpringBoot/java/module/wsys/req/" + name , ctx ) ;
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/rsp/" ) ) {
if ( compile . matcher ( name ) . find ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( rsp , name ) , "SpringBoot/java/module/wsys/rsp/" + name , ctx ) ;
}
}
}
}
public void generateModuleFor 网 页 框 架 ( File root , Project project ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ;
Module wsysModule = tryGetModule ( project , "wsys" ) ;
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
@ -461,9 +326,6 @@ public class SpringBootCallable implements Callable {
}
}
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mgr/" ) ) {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/java/module/wsys/mgr/" ) ) {
if ( name . contains ( "TokensManager" ) & & project . getFrame ( ) . value ( ) < Frame . 接 口 框 架 . value ( ) ) { // 当不需要Web和Api时不需要处理Token问题
continue ;
}
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsys/mgr/" + name , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( mgr , name ) , "SpringBoot/java/module/wsys/mgr/" + name , ctx ) ;
}
}
@ -538,44 +400,41 @@ public class SpringBootCallable implements Callable {
}
}
//excel
//excel
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
File excel = Tool . createPath ( root , "excel" ) ;
File excel = Tool . createPath ( root , "excel" ) ;
File excelannotation = Tool . createPath ( excel , "annotation" ) ;
File excelannotation = Tool . createPath ( excel , "annotation" ) ;
File excelconverter = Tool . createPath ( excel , "converter" ) ;
File excelconverter = Tool . createPath ( excel , "converter" ) ;
File exception = Tool . createPath ( excel , "exception" ) ;
File exception = Tool . createPath ( excel , "exception" ) ;
File excelhandler = Tool . createPath ( excel , "handler" ) ;
File excelhandler = Tool . createPath ( excel , "handler" ) ;
File excellistener = Tool . createPath ( excel , "listener" ) ;
File excellistener = Tool . createPath ( excel , "listener" ) ;
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 , 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 , 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 , 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 , 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 , 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 , name ) , "SpringBoot/java/frame/excel/listener/" + name , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( excellistener , name ) , "SpringBoot/java/frame/excel/listener/" + name , ctx ) ;
}
}
}
//validation
//validation
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
File validation = Tool . createPath ( root , "validation" ) ;
File validation = Tool . createPath ( root , "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 , name ) , "SpringBoot/java/frame/validation/" + name , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( validation , name ) , "SpringBoot/java/frame/validation/" + name , ctx ) ;
}
}
}
}
}
/ * *
/ * *
* 生 成 frame 类
* 生 成 Task 类
*
*
* @param root
* @param root
* @param project
* @param project
@ -592,7 +451,7 @@ 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/" ) ) {
if ( name . contains ( "TokenTask" ) & & project . getFrame ( ) . value ( ) < Frame . 网 页 框 架 . value ( ) ) {
if ( name . contains ( "TokenTask" ) & & project . getFrame ( ) . value ( ) == Frame . 无 . value ( ) ) {
continue ;
continue ;
}
}
freeMarkerManager . outputTemp ( Tool . createFile ( root , name ) , "SpringBoot/java/task/" + name , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , name ) , "SpringBoot/java/task/" + name , ctx ) ;
@ -630,175 +489,172 @@ public class SpringBootCallable implements Callable {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "application.properties" ) , "SpringBoot/resources/application.ftl" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "application.properties" ) , "SpringBoot/resources/application.ftl" , ctx ) ;
if ( project . getFrame ( ) . value ( ) > Frame . 空 白 框 架 . value ( ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( root , "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 , "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 , "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 , "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 , "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 , "logback-spring-prod.xml" ) ) ;
Tool . outputResource ( "SpringBoot/resources/logback-spring-prod.xml" , Tool . createFile ( root , "logback-spring-prod.xml" ) ) ;
File dbtool = Tool . createPath ( root , "dbtool" ) ;
File dbtool = Tool . createPath ( root , "dbtool" ) ;
{
{
XmlManager xmlManager = ManagerFactory . getXmlManager ( ) ;
XmlManager xmlManager = ManagerFactory . getXmlManager ( ) ;
xmlManager . saveAs ( dbtool , project ) ;
xmlManager . saveAs ( dbtool , project ) ;
}
}
for ( Module module : project . getModules ( ) ) {
for ( Module module : project . getModules ( ) ) {
if ( module . getNeedGenerate ( ) ) {
if ( module . getNeedGenerate ( ) ) {
ctx . put ( "moduleName" , module . getModuleName ( ) ) ;
ctx . put ( "moduleName" , module . getModuleName ( ) ) ;
ctx . put ( "module" , module ) ;
ctx . put ( "module" , module ) ;
File tableDir = Tool . createPath ( dbtool , 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 , 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 , 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 . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
File lib = Tool . createPath ( root , "lib" ) ;
Module wsvrModule = tryGetModule ( project , "wsvr" ) ;
if ( wsvrModule = = null | | ! wsvrModule . getNeedGenerate ( ) ) { // 覆盖
File wsvr = Tool . createPath ( dbtool , "wsvr_table" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/dbtool/wsvr_table/" ) ) {
if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsvr , name ) , "SpringBoot/resources/dbtool/wsvr_table/" + name , ctx ) ;
}
}
}
}
if ( project . getFrame ( ) . value ( ) >= Frame . 网 页 框 架 . value ( ) ) { //生成系统模块
if ( project . getFrame ( ) . value ( ) = = Frame . 管 理 框 架 . value ( ) ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ;
Module wsysModule = tryGetModule ( project , "wsys" ) ;
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 覆盖
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) { // 覆盖
File wsys = Tool . createPath ( dbtool , "wsys_table" ) ;
File wsys = Tool . createPath ( dbtool , "wsys_table" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/dbtool/wsys_table/" ) ) {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/dbtool/wsys_table/" ) ) {
if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
if ( name . contains ( project . getDatabase ( ) . name ( ) ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , name ) , "SpringBoot/resources/dbtool/wsys_table/" + name , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , name ) , "SpringBoot/resources/dbtool/wsys_table/" + name , ctx ) ;
}
}
}
}
}
}
}
}
// if (DataBase.Oracle.name().equals(project.getDatabase().name())) {
// if (DataBase.Oracle.name().equals(project.getDatabase().name())) {
// File lib = Tool.createPath(root, "lib");
// File lib = Tool.createPath(root, "lib");
// Tool.outputResource("SpringBoot/resources/lib/ojdbc7-12.1.0.2.jar", Tool.createFile(lib, "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 , project . getName ( ) + ".db3" ) ;
File dbFile = Tool . createFile ( root , project . getName ( ) + ".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 ) ;
connection = DriverManager . getConnection ( "jdbc:sqlite:" + dbFile ) ;
for ( File fileModule : dbtool . listFiles ( ) ) {
for ( File fileModule : dbtool . listFiles ( ) ) {
if ( ! fileModule . isDirectory ( ) ) {
if ( ! fileModule . isDirectory ( ) ) {
continue ;
continue ;
}
}
for ( File file : fileModule . listFiles ( ) ) {
for ( File file : fileModule . listFiles ( ) ) {
if ( file . getName ( ) . startsWith ( "SQLite_" ) & & ! file . getName ( ) . startsWith ( "SQLite_ALL_" ) & & file . getName ( ) . endsWith ( ".sql" ) ) {
if ( file . getName ( ) . startsWith ( "SQLite_" ) & & ! file . getName ( ) . startsWith ( "SQLite_ALL_" ) & & file . getName ( ) . endsWith ( ".sql" ) ) {
statement = connection . createStatement ( ) ;
statement = connection . createStatement ( ) ;
String sql = FileUtil . readFileToString ( file ) ;
String sql = FileUtil . readFileToString ( file ) ;
statement . execute ( sql ) ;
statement . execute ( sql ) ;
statement . close ( ) ;
statement . close ( ) ;
}
}
}
}
}
} catch ( ClassNotFoundException | SQLException | IOException e ) {
}
e . printStackTrace ( ) ;
} catch ( ClassNotFoundException | SQLException | IOException e ) {
} finally {
e . printStackTrace ( ) ;
try {
} finally {
if ( statement ! = null ) statement . close ( ) ;
try {
if ( connection ! = null ) connection . close ( ) ;
if ( statement ! = null ) statement . close ( ) ;
} catch ( Exception e ) {
if ( connection ! = null ) connection . close ( ) ;
} catch ( Exception e ) {
}
}
}
}
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
{
System . out . println ( "生成模块:Static" ) ;
System . out . println ( "生成模块:Static" ) ;
File static_ = Tool . createPath ( root , "static" ) ;
File static_ = Tool . createPath ( root , "static" ) ;
File css = Tool . createPath ( static_ , "css" ) ;
File css = Tool . createPath ( static_ , "css" ) ;
File img = Tool . createPath ( static_ , "img" ) ;
File img = Tool . createPath ( static_ , "img" ) ;
File dist = Tool . createPath ( static_ , "dist" ) ;
File dist = Tool . createPath ( static_ , "dist" ) ;
Tool . outputResource ( "SpringBoot/resources/static/favicon.ico" , Tool . createFile ( static_ , "favicon.ico" ) ) ;
Tool . outputResource ( "SpringBoot/resources/static/favicon.ico" , Tool . createFile ( static_ , "favicon.ico" ) ) ;
//css文件
//css文件
freeMarkerManager . outputTemp ( Tool . createFile ( css , "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 , "logo.png" ) ) ;
Tool . outputResource ( "SpringBoot/resources/static/img/logo.png" , Tool . createFile ( img , "logo.png" ) ) ;
// dist文件jquery + vue + vue-router + axios
// dist文件jquery + vue + vue-router + axios
Tool . outputResource ( "SpringBoot/resources/static/dist/lib.min.js" , Tool . createFile ( dist , "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 , "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 , "index.min.css" ) ) ;
Tool . outputResource ( "SpringBoot/resources/static/dist/index.min.css" , Tool . createFile ( dist , "index.min.css" ) ) ;
File fonts = Tool . createPath ( dist , "fonts" ) ;
File fonts = Tool . createPath ( dist , "fonts" ) ;
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/w-e-icon.woff" , Tool . createFile ( fonts , "w-e-icon.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.woff" , Tool . createFile ( fonts , "element-icons.woff" ) ) ;
Tool . outputResource ( "SpringBoot/resources/static/dist/fonts/element-icons.ttf" , Tool . createFile ( fonts , "element-icons.ttf" ) ) ;
Tool . outputResource ( "SpringBoot/resources/static/dist/fonts/element-icons.ttf" , Tool . createFile ( fonts , "element-icons.ttf" ) ) ;
System . out . println ( "生成模块:Templates" ) ;
System . out . println ( "生成模块:Templates" ) ;
File templates = Tool . createPath ( root , "templates" ) ;
File templates = Tool . createPath ( root , "templates" ) ;
File control = Tool . createPath ( templates , "control" ) ;
File control = Tool . createPath ( templates , "control" ) ;
File layout = Tool . createPath ( templates , "layout" ) ;
File layout = Tool . createPath ( templates , "layout" ) ;
File screen = Tool . createPath ( templates , "screen" ) ;
File screen = Tool . createPath ( templates , "screen" ) ;
Tool . outputResource ( "SpringBoot/resources/templates/control/nav.ftl" , Tool . createFile ( control , "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 , "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 , "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 , "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 , "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 , "403.ftl" ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/403.ftl" , Tool . createFile ( templates , "403.ftl" ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/404.ftl" , Tool . createFile ( templates , "404.ftl" ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/404.ftl" , Tool . createFile ( templates , "404.ftl" ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/500.ftl" , Tool . createFile ( templates , "500.ftl" ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/500.ftl" , Tool . createFile ( templates , "500.ftl" ) ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( screen , "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 , mo . getModuleName ( ) ) ;
File module = Tool . createPath ( screen , mo . getModuleName ( ) ) ;
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 , 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 . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) {
if ( project . getFrame ( ) . value ( ) = = Frame . 管 理 框 架 . value ( ) ) {
Module wsysModule = tryGetModule ( project , "wsys" ) ; // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
Module wsysModule = tryGetModule ( project , "wsys" ) ; // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) {
if ( wsysModule = = null | | ! wsysModule . getNeedGenerate ( ) ) {
File wsys = Tool . createPath ( screen , "wsys" ) ;
File wsys = Tool . createPath ( screen , "wsys" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/templates/screen/module/wsys/" ) ) {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/templates/screen/module/wsys/" ) ) {
Tool . outputResource ( "SpringBoot/resources/templates/screen/module/wsys/" + name , Tool . createFile ( wsys , name ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/screen/module/wsys/" + name , Tool . createFile ( wsys , name ) ) ;
}
}
}
}
Module wsvrModule = tryGetModule ( project , "wsvr" ) ; // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
Module wsvrModule = tryGetModule ( project , "wsvr" ) ; // 防止与系统冲突,一般不会重复,通常是架构重新设计时遇到
if ( wsvrModule = = null | | ! wsvrModule . getNeedGenerate ( ) ) {
if ( wsvrModule = = null | | ! wsvrModule . getNeedGenerate ( ) ) {
File wsvr = Tool . createPath ( screen , "wsvr" ) ;
File wsvr = Tool . createPath ( screen , "wsvr" ) ;
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/templates/screen/module/wsvr/" ) ) {
for ( String name : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/resources/templates/screen/module/wsvr/" ) ) {
Tool . outputResource ( "SpringBoot/resources/templates/screen/module/wsvr/" + name , Tool . createFile ( wsvr , name ) ) ;
Tool . outputResource ( "SpringBoot/resources/templates/screen/module/wsvr/" + name , Tool . createFile ( wsvr , name ) ) ;
}
}
}
}
}
}
}
}
}
}
}
/ * *
* 生 成 Resources_template
*
* @param root
* @param project
* /
public void generateResources_template ( File root , Project project ) {
}
public void generateTestResources ( File root , Project project ) {
public void generateTestResources ( File root , Project project ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
@ -831,6 +687,7 @@ public class SpringBootCallable implements Callable {
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
File file = Tool . createFile ( root , "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 ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ExcelTest.java" ) , "SpringBoot/test/ExcelTest.java" , ctx ) ;
}
}
for ( Module md : project . getModules ( ) ) {
for ( Module md : project . getModules ( ) ) {
@ -852,61 +709,20 @@ public class SpringBootCallable implements Callable {
}
}
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 服 务 框 架 . value ( ) ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
File wsvr = Tool . createPath ( root , "wsvr" ) ;
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsvr/" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsvr , apiFile ) , "SpringBoot/test/wsvr/" + apiFile , ctx ) ;
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
File wsys = Tool . createPath ( root , "wsys" ) ;
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsys/" ) ) {
if ( apiFile . contains ( "Dict" ) ) {
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , apiFile ) , "SpringBoot/test/wsys/" + apiFile , ctx ) ;
}
}
}
if ( project . getFrame ( ) . value ( ) >= Frame . 网 页 框 架 . value ( ) ) {
if ( project . getFrame ( ) . value ( ) = = Frame . 管 理 框 架 . value ( ) ) {
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "moduleName" , project . getName ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "author" , project . getAuthor ( ) ) ;
ctx . put ( "project" , project ) ;
File wsys = Tool . createPath ( root , "wsys" ) ;
File wsys = Tool . createPath ( root , "wsys" ) ;
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsys/" ) ) {
for ( String apiFile : ResourceUtil . getResourceFiles ( "/modules/SpringBoot/test/wsys/" ) ) {
if ( apiFile . contains ( "TokensTest" ) & & project . getFrame ( ) . value ( ) < Frame . 接 口 框 架 . value ( ) ) {
continue ;
}
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , apiFile ) , "SpringBoot/test/wsys/" + apiFile , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( wsys , apiFile ) , "SpringBoot/test/wsys/" + apiFile , ctx ) ;
}
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 接 口 框 架 . value ( ) ) { //数据初始化
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "project" , project ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "DataInit.java" ) , "SpringBoot/test/DataInit.java" , ctx ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "DataInit.java" ) , "SpringBoot/test/DataInit.java" , ctx ) ;
}
}
if ( project . getFrame ( ) . value ( ) > = Frame . 网 页 框 架 . value ( ) ) { //数据初始化
HashMap < String , Object > ctx = new HashMap < String , Object > ( ) ;
ctx . put ( "domain" , project . getDomain ( ) ) ;
freeMarkerManager . outputTemp ( Tool . createFile ( root , "ExcelTest.java" ) , "SpringBoot/test/ExcelTest.java" , ctx ) ;
}
}
}
private Module tryGetModule ( Project project , String moduleName ) {
private Module tryGetModule ( Project project , String moduleName ) {