diff --git a/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java b/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java index 2a6ae34c..ed24dd9b 100644 --- a/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java +++ b/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java @@ -642,6 +642,7 @@ public class SpringBootCallable implements Callable { ctx.put("project", project); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "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.getAbsolutePath(), "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.getAbsolutePath(), "application-prod.properties"), "SpringBoot/resources/application-prod.ftl", ctx); Tool.outputResource("SpringBoot/resources/logback-spring.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring.xml")); @@ -902,11 +903,8 @@ public class SpringBootCallable implements Callable { ctx.put("author", project.getProjectAuthor()); ctx.put("date", new Date()); ctx.put("project", project); - File system = Tool.createPath(root.getAbsolutePath(), "datainit"); - for (String apiFile : ResourceUtil.getResourceFiles("/modules/SpringBoot/test/datainit/")) { - freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), apiFile), "SpringBoot/test/datainit/" + apiFile, ctx); - } + freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "DataInit.java"), "SpringBoot/test/DataInit.java", ctx); } } } diff --git a/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java b/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java index 5315a27e..63931105 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java +++ b/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java @@ -92,4 +92,9 @@ public class LocalData { public static Environment getEnvironment() { return getBean(Environment.class); } + + public static String getActive() { + String[] profiles = getEnvironment().getActiveProfiles(); + return String.join(",", profiles); + } } diff --git a/src/main/resources/modules/SpringBoot/java/frame/auth/Token.java b/src/main/resources/modules/SpringBoot/java/frame/auth/Token.java index 88360644..8fcbfb94 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/auth/Token.java +++ b/src/main/resources/modules/SpringBoot/java/frame/auth/Token.java @@ -43,24 +43,22 @@ public class Token implements Serializable { public boolean hasRes(String res) { {// todo 开发初期收集资源,后期删除 - String[] profiles = LocalData.getEnvironment().getActiveProfiles(); - for (String profile : profiles) { - if (profile.contains("dev")) {//测试环境捕获资源 - ResFindRequest resFindRequest = new ResFindRequest(); - resFindRequest.setPageSize(0); - resFindRequest.setResValue(res); - ResManager resManager = LocalData.getBean(ResManager.class); - ResFindResponse resFindResponse = resManager.find(resFindRequest, LocalData.getSysToken()); - - if (resFindResponse.getResult().size() == 0) {//资源不存在,主动收集资源 - ResCreateRequest resCreateRequest = new ResCreateRequest(); - resCreateRequest.setResCode(IDgenerator.nextUUID()); - resCreateRequest.setResName("默认"); - resCreateRequest.setResValue(res); - resCreateRequest.setValid(true); - resCreateRequest.setResType(""); - resManager.create(resCreateRequest, LocalData.getSysToken()); - } + String active = LocalData.getActive(); + if (active.contains("dev")) {//测试环境捕获资源 + ResFindRequest resFindRequest = new ResFindRequest(); + resFindRequest.setPageSize(0); + resFindRequest.setResValue(res); + ResManager resManager = LocalData.getBean(ResManager.class); + ResFindResponse resFindResponse = resManager.find(resFindRequest, LocalData.getSysToken()); + + if (resFindResponse.getResult().size() == 0) {//资源不存在,主动收集资源 + ResCreateRequest resCreateRequest = new ResCreateRequest(); + resCreateRequest.setResCode(IDgenerator.nextUUID()); + resCreateRequest.setResName("默认"); + resCreateRequest.setResValue(res); + resCreateRequest.setValid(true); + resCreateRequest.setResType(""); + resManager.create(resCreateRequest, LocalData.getSysToken()); } } } @@ -93,7 +91,6 @@ public class Token implements Serializable { return resSet; } - public long getId() { return id; } diff --git a/src/main/resources/modules/SpringBoot/java/frame/excel/annotation/Ignore.java b/src/main/resources/modules/SpringBoot/java/frame/excel/annotation/Ignore.java index 75327992..ae038654 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/excel/annotation/Ignore.java +++ b/src/main/resources/modules/SpringBoot/java/frame/excel/annotation/Ignore.java @@ -7,7 +7,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Ignore - Excel列忽略注解,在导入导出过程中不会对存在该注解的字典进行解析 + * Ignore - Excel列忽略注解,在导入导出过程中不会对存在该注解的字段进行解析 * * @author wangbing * @version 0.0.1 diff --git a/src/main/resources/modules/SpringBoot/java/frame/utils/ZipUtil.java b/src/main/resources/modules/SpringBoot/java/frame/utils/ZipUtil.java index fcdb8dca..5b16176d 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/utils/ZipUtil.java +++ b/src/main/resources/modules/SpringBoot/java/frame/utils/ZipUtil.java @@ -135,11 +135,4 @@ public class ZipUtil { in.close(); } } - - public static void main(String[] args) { - //解压 - unZip(new File("E:\\AAA.zip"), new File("E:\\AAA")); - //压缩 - toZip(new File("E:\\AAA"), new File("E:\\AAA.zip")); - } } diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResManagerImpl.java index ba6c23d7..92697cb1 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResManagerImpl.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResManagerImpl.java @@ -64,6 +64,17 @@ public class ResManagerImpl implements ResManager { return response; } + ResFindRequest resFindRequest = new ResFindRequest(); + resFindRequest.setResCode(request.getResCode()); + ResFindResponse resFindResponse = this.find(resFindRequest, token); + if (resFindResponse.hasError()) { + response.addErrors(resFindResponse.getErrors()); + return response; + } else if (resFindResponse.getResult().size() > 0) { + response.addError(ErrorType.BUSINESS_ERROR, Message.INSERT_DUPLICATE); + return response; + } + long id = IDgenerator.nextId(); Res entity = MapperUtil.map(request, Res.class); entity.setId(id); diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DeptMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DeptMapper.xml index d28c35ea..f29f079c 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DeptMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DeptMapper.xml @@ -2,7 +2,7 @@ - + "SYS_DEPT" @@ -10,7 +10,7 @@ "ID","DEPT_CODE","DEPT_NAME","DEPT_ALIAS","SUP_CODE","SUP_NAME","VALID","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictItemMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictItemMapper.xml index 23c9d053..6f3722b3 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictItemMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictItemMapper.xml @@ -2,7 +2,7 @@ - + "SYS_DICT_ITEM" @@ -10,7 +10,7 @@ "ID","DICT_NAME","KEY","VALUE","SORT","VALID","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictMapper.xml index 82df4a8c..439adcc5 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_DictMapper.xml @@ -2,7 +2,7 @@ - + "SYS_DICT" @@ -10,7 +10,7 @@ "ID","DICT_NAME","DICT_COMMENT","VERSION","VALID","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_FileMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_FileMapper.xml index 3ad6bda1..c41c7e00 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_FileMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_FileMapper.xml @@ -2,7 +2,7 @@ - + "SYS_FILE" @@ -10,7 +10,7 @@ "ID","NAME","FILE_TYPE","ATTRIBUTE1","ATTRIBUTE2","LOCATION","URL","URL_DOWNLOAD","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_LogErrMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_LogErrMapper.xml index 14ee435d..efc7cdb3 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_LogErrMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_LogErrMapper.xml @@ -2,7 +2,7 @@ - + "SYS_LOG_ERR" @@ -10,7 +10,7 @@ "ID","LOG_ERR_TYPE","TITLE","CONTENT","LOG_ERR_RESULT","ATTRIBUTE1","ATTRIBUTE2","ATTRIBUTE3","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_ResMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_ResMapper.xml index 47850f14..26a342af 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_ResMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_ResMapper.xml @@ -2,7 +2,7 @@ - + "SYS_RES" @@ -10,7 +10,7 @@ "ID","RES_CODE","RES_NAME","RES_TYPE","RES_VALUE","SUP_CODE","SUP_NAME","VALID","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleMapper.xml index ad245b55..d6911bc0 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleMapper.xml @@ -2,7 +2,7 @@ - + "SYS_ROLE" @@ -10,7 +10,7 @@ "ID","CODE","NAME","COMMENT","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleResMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleResMapper.xml index fab2aaab..271489c9 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleResMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_RoleResMapper.xml @@ -2,7 +2,7 @@ - + "SYS_ROLE_RES" @@ -10,7 +10,7 @@ "ID","ROLE_ID","ROLE_CODE","RES_ID","RES_CODE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_TokensMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_TokensMapper.xml index 3e3a4ec8..cdcacbdb 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_TokensMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_TokensMapper.xml @@ -2,7 +2,7 @@ - + "SYS_TOKENS" @@ -10,7 +10,7 @@ "ID","TOKEN","USER_ID","USER_NAME","LOGIN_TIME","VALID_TIME","VALID","DEPT_ID","DEPT_CODE","DEPT_NAME","TERMINAL_TYPE","TERMINAL_IP","TERMINAL_INFO","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserMapper.xml index feb54170..6a3ccb9a 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserMapper.xml @@ -2,7 +2,7 @@ - + "SYS_USER" @@ -10,7 +10,7 @@ "ID","USER_NAME","USER_CODE","USER_ALIAS","USER_PWD","USER_STATUS","DEPT_ID","DEPT_CODE","DEPT_NAME","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserRoleMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserRoleMapper.xml index 565742c5..d15bbae0 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserRoleMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/SQLite_UserRoleMapper.xml @@ -2,7 +2,7 @@ - + "SYS_USER_ROLE" @@ -10,7 +10,7 @@ "ID","USER_ID","USER_CODE","ROLE_ID","ROLE_CODE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME" - + diff --git a/src/main/resources/modules/SpringBoot/resources/application.ftl b/src/main/resources/modules/SpringBoot/resources/application.ftl new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/resources/application.ftl @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl index 45153775..071b37c6 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl @@ -21,12 +21,21 @@ text-color="#d6d6d6" active-text-color="#ffd04b"> <#if sysMD> + + + 资源管理 + 错误日志 + 计划调度 + - 字典管理 + 字典管理 文件管理 资源管理 用户管理 @@ -34,20 +43,6 @@ 角色管理 登录管理 - - - 任务列表 - - - - 错误日志 - <#list modules as item> <#if item.hasHtml()> @@ -77,16 +72,9 @@