From 1b93235b72533e4bd0faf2fd7b64bc07f974d782 Mon Sep 17 00:00:00 2001 From: lbw Date: Fri, 7 Jan 2022 11:36:59 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20Fixing=20a=20bug.=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=BB=E9=94=AE=E7=B1=BB=E5=9E=8B=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/pig.sql | 2 +- db/v3.4.2_v.3.4.3.diff.sql | 107 ------------------ .../messages/messages_zh_CN.properties | 62 ---------- pig-visual/pig-codegen/pom.xml | 2 +- .../pig/codegen/support/CodeGenKits.java | 6 + .../src/main/resources/template/menu.sql.vm | 29 ++--- pom.xml | 2 +- 7 files changed, 24 insertions(+), 186 deletions(-) delete mode 100644 db/v3.4.2_v.3.4.3.diff.sql delete mode 100755 pig-common/pig-common-security/src/main/resources/messages/messages_zh_CN.properties diff --git a/db/pig.sql b/db/pig.sql index b47f9359..dbb2c364 100644 --- a/db/pig.sql +++ b/db/pig.sql @@ -209,7 +209,7 @@ CREATE TABLE `sys_menu` ( `name` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单名称', `permission` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '菜单权限标识', `path` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端URL', - `parent_id` int DEFAULT NULL COMMENT '父菜单ID', + `parent_id` bigint DEFAULT NULL COMMENT '父菜单ID', `icon` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '图标', `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序值', `keep_alive` char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '0-开启,1- 关闭', diff --git a/db/v3.4.2_v.3.4.3.diff.sql b/db/v3.4.2_v.3.4.3.diff.sql deleted file mode 100644 index 976e7614..00000000 --- a/db/v3.4.2_v.3.4.3.diff.sql +++ /dev/null @@ -1,107 +0,0 @@ -SET FOREIGN_KEY_CHECKS=0; - --- 核心库 -USE `pig`; - --- 修正老数据 - -update `sys_dept` set create_by=' ' where create_by is null ; - -update `sys_dept` set update_by=' ' where update_by is null ; - -update `sys_dept` set create_time=NOW() where create_time is null ; - -update `sys_dept` set update_time=NOW() where update_time is null ; - -update `sys_dict` set create_by=' ' where create_by is null ; - -update `sys_dict` set update_by=' ' where update_by is null ; - -update `sys_dict` set create_time=NOW() where create_time is null ; - -update `sys_dict` set update_time=NOW() where update_time is null ; - -UPDATE `sys_dict` SET `type` = 'dict_type', `description` = '字典类型', `remarks` = '', `system` = '1', `del_flag` = '0', `create_time` = '2019-05-16 14:16:20', `create_by` = '', `update_by` = 'admin', `update_time` = '2021-12-29 12:29:18' WHERE `id` = 1; - -UPDATE `sys_dict` SET `type` = 'log_type', `description` = '日志类型', `remarks` = '', `system` = '1', `del_flag` = '0', `create_time` = '2020-03-13 14:21:01', `create_by` = '', `update_by` = 'admin', `update_time` = '2021-12-29 12:30:14' WHERE `id` = 2; - -UPDATE `sys_dict` SET `type` = 'ds_type', `description` = '驱动类型', `remarks` = '', `system` = '1', `del_flag` = '0', `create_time` = '2021-10-15 16:24:35', `create_by` = '', `update_by` = 'admin', `update_time` = '2021-12-29 12:30:18' WHERE `id` = 3; - -update `sys_menu` set create_by=' ' where create_by is null ; - -update `sys_menu` set update_by=' ' where update_by is null ; - -update `sys_menu` set create_time=NOW() where create_time is null ; - -update `sys_menu` set update_time=NOW() where update_time is null ; - --- 变更表结构 - -alter table sys_dept modify dept_id BIGINT; - -alter table sys_dept modify parent_id BIGINT; - - -ALTER TABLE `sys_dept` ADD COLUMN `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序' AFTER `name`; - -ALTER TABLE `sys_dept` DROP COLUMN `sort`; - -alter table `sys_dept_relation` modify ancestor BIGINT; - -alter table `sys_dept_relation` modify descendant BIGINT; - -alter table `sys_dict` modify id BIGINT; - -ALTER TABLE `sys_dict` ADD COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '备注' AFTER `description`; - -ALTER TABLE `sys_dict` ADD COLUMN `system_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否是系统内置' AFTER `remark`; - -ALTER TABLE `sys_dict` DROP COLUMN `remarks`; -ALTER TABLE `sys_dict` DROP COLUMN `remarks`; - -ALTER TABLE `sys_dict` DROP COLUMN `system`; - -alter table `sys_dict_item` modify id BIGINT; - -ALTER TABLE `sys_dict_item` ADD COLUMN `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序(升序)' AFTER `description`; - -ALTER TABLE `sys_dict_item` DROP COLUMN `sort`; - -ALTER TABLE `sys_dict_item` DROP COLUMN `remarks`; - -alter table `sys_file` modify id BIGINT; - -alter table `sys_log` modify id BIGINT; - -ALTER TABLE `sys_log` MODIFY COLUMN `time` bigint COMMENT '执行时间' AFTER `params`; - -alter table `sys_menu` modify menu_id BIGINT; - -ALTER TABLE `sys_menu` ADD COLUMN `sort_order` int NOT NULL DEFAULT 0 COMMENT '排序值' AFTER `icon`; - -ALTER TABLE `sys_menu` DROP COLUMN `sort`; - -ALTER TABLE `sys_menu` DROP COLUMN `component`; - -alter table `sys_role` modify role_id BIGINT; - -alter table `sys_role_menu` modify role_id BIGINT; - -alter table `sys_role_menu` modify menu_id BIGINT; - -alter table `sys_user` modify user_id BIGINT; - -alter table `sys_user` modify dept_id BIGINT; - -alter table `sys_user_role` modify user_id BIGINT; - -alter table `sys_user_role` modify role_id BIGINT; - --- 代码生成器 -USE `pig_codegen`; - -alter table `gen_datasource_conf` modify id BIGINT; - -alter table `gen_form_conf` modify id BIGINT; - -SET FOREIGN_KEY_CHECKS=1; diff --git a/pig-common/pig-common-security/src/main/resources/messages/messages_zh_CN.properties b/pig-common/pig-common-security/src/main/resources/messages/messages_zh_CN.properties deleted file mode 100755 index c2333d8e..00000000 --- a/pig-common/pig-common-security/src/main/resources/messages/messages_zh_CN.properties +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -AbstractAccessDecisionManager.accessDenied=\u4E0D\u5141\u8BB8\u8BBF\u95EE -AbstractLdapAuthenticationProvider.emptyPassword=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A -AbstractSecurityInterceptor.authenticationNotFound=\u672A\u5728SecurityContext\u4E2D\u67E5\u627E\u5230\u8BA4\u8BC1\u5BF9\u8C61 -AbstractUserDetailsAuthenticationProvider.badCredentials=\u7528\u6237\u540D\u4E0D\u5B58\u5728\u6216\u8005\u5BC6\u7801\u9519\u8BEF -AbstractUserDetailsAuthenticationProvider.noopBindAccount=\u672A\u7ED1\u5B9A\u767B\u5F55\u8D26\u53F7\uFF0C\u8BF7\u4F7F\u7528\u5BC6\u7801\u767B\u5F55\u540E\u7ED1\u5B9A -AbstractUserDetailsAuthenticationProvider.credentialsExpired=\u7528\u6237\u51ED\u8BC1\u5DF2\u8FC7\u671F -AbstractUserDetailsAuthenticationProvider.disabled=\u7528\u6237\u672A\u6FC0\u6D3B -AbstractUserDetailsAuthenticationProvider.expired=\u7528\u6237\u5E10\u53F7\u5DF2\u8FC7\u671F -AbstractUserDetailsAuthenticationProvider.locked=\u7528\u6237\u5E10\u53F7\u5DF2\u88AB\u9501\u5B9A -AbstractUserDetailsAuthenticationProvider.onlySupports=\u4EC5\u4EC5\u652F\u6301UsernamePasswordAuthenticationToken -AccountStatusUserDetailsChecker.credentialsExpired=\u7528\u6237\u51ED\u8BC1\u5DF2\u8FC7\u671F -AccountStatusUserDetailsChecker.disabled=\u7528\u6237\u672A\u6FC0\u6D3B -AccountStatusUserDetailsChecker.expired=\u7528\u6237\u5E10\u53F7\u5DF2\u8FC7\u671F -AccountStatusUserDetailsChecker.locked=\u7528\u6237\u5E10\u53F7\u5DF2\u88AB\u9501\u5B9A -AclEntryAfterInvocationProvider.noPermission=\u7ED9\u5B9A\u7684Authentication\u5BF9\u8C61({0})\u6839\u672C\u65E0\u6743\u64CD\u63A7\u9886\u57DF\u5BF9\u8C61({1}) -AnonymousAuthenticationProvider.incorrectKey=\u5C55\u793A\u7684AnonymousAuthenticationToken\u4E0D\u542B\u6709\u9884\u671F\u7684key -BindAuthenticator.badCredentials=\u5BC6\u7801\u9519\u8BEF -BindAuthenticator.emptyPassword=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A -CasAuthenticationProvider.incorrectKey=\u5C55\u793A\u7684CasAuthenticationToken\u4E0D\u542B\u6709\u9884\u671F\u7684key -CasAuthenticationProvider.noServiceTicket=\u672A\u80FD\u591F\u6B63\u786E\u63D0\u4F9B\u5F85\u9A8C\u8BC1\u7684CAS\u670D\u52A1\u7968\u6839 -ConcurrentSessionControlAuthenticationStrategy.exceededAllowed=\u5DF2\u7ECF\u8D85\u8FC7\u4E86\u5F53\u524D\u4E3B\u4F53({0})\u88AB\u5141\u8BB8\u7684\u6700\u5927\u4F1A\u8BDD\u6570\u91CF -DigestAuthenticationFilter.incorrectRealm=\u54CD\u5E94\u7ED3\u679C\u4E2D\u7684Realm\u540D\u5B57({0})\u540C\u7CFB\u7EDF\u6307\u5B9A\u7684Realm\u540D\u5B57({1})\u4E0D\u543B\u5408 -DigestAuthenticationFilter.incorrectResponse=\u9519\u8BEF\u7684\u54CD\u5E94\u7ED3\u679C -DigestAuthenticationFilter.missingAuth=\u9057\u6F0F\u4E86\u9488\u5BF9'auth' QOP\u7684\u3001\u5FC5\u987B\u7ED9\u5B9A\u7684\u6458\u8981\u53D6\u503C; \u63A5\u6536\u5230\u7684\u5934\u4FE1\u606F\u4E3A{0} -DigestAuthenticationFilter.missingMandatory=\u9057\u6F0F\u4E86\u5FC5\u987B\u7ED9\u5B9A\u7684\u6458\u8981\u53D6\u503C; \u63A5\u6536\u5230\u7684\u5934\u4FE1\u606F\u4E3A{0} -DigestAuthenticationFilter.nonceCompromised=Nonce\u4EE4\u724C\u5DF2\u7ECF\u5B58\u5728\u95EE\u9898\u4E86\uFF0C{0} -DigestAuthenticationFilter.nonceEncoding=Nonce\u672A\u7ECF\u8FC7Base64\u7F16\u7801; \u76F8\u5E94\u7684nonce\u53D6\u503C\u4E3A {0} -DigestAuthenticationFilter.nonceExpired=Nonce\u5DF2\u7ECF\u8FC7\u671F/\u8D85\u65F6 -DigestAuthenticationFilter.nonceNotNumeric=Nonce\u4EE4\u724C\u7684\u7B2C1\u90E8\u5206\u5E94\u8BE5\u662F\u6570\u5B57\uFF0C\u4F46\u7ED3\u679C\u5374\u662F{0} -DigestAuthenticationFilter.nonceNotTwoTokens=Nonce\u5E94\u8BE5\u7531\u4E24\u90E8\u5206\u53D6\u503C\u6784\u6210\uFF0C\u4F46\u7ED3\u679C\u5374\u662F{0} -DigestAuthenticationFilter.usernameNotFound=\u7528\u6237\u540D{0}\u672A\u627E\u5230 -JdbcDaoImpl.noAuthority=\u6CA1\u6709\u4E3A\u7528\u6237{0}\u6307\u5B9A\u89D2\u8272 -JdbcDaoImpl.notFound=\u672A\u627E\u5230\u7528\u6237{0} -LdapAuthenticationProvider.badCredentials=\u574F\u7684\u51ED\u8BC1 -LdapAuthenticationProvider.credentialsExpired=\u7528\u6237\u51ED\u8BC1\u5DF2\u8FC7\u671F -LdapAuthenticationProvider.disabled=\u7528\u6237\u672A\u6FC0\u6D3B -LdapAuthenticationProvider.expired=\u7528\u6237\u5E10\u53F7\u5DF2\u8FC7\u671F -LdapAuthenticationProvider.locked=\u7528\u6237\u5E10\u53F7\u5DF2\u88AB\u9501\u5B9A -LdapAuthenticationProvider.emptyUsername=\u7528\u6237\u540D\u4E0D\u5141\u8BB8\u4E3A\u7A7A -LdapAuthenticationProvider.onlySupports=\u4EC5\u4EC5\u652F\u6301UsernamePasswordAuthenticationToken -PasswordComparisonAuthenticator.badCredentials=\u574F\u7684\u51ED\u8BC1 -ProviderManager.providerNotFound=\u672A\u67E5\u627E\u5230\u9488\u5BF9{0}\u7684AuthenticationProvider -RememberMeAuthenticationProvider.incorrectKey=\u5C55\u793ARememberMeAuthenticationToken\u4E0D\u542B\u6709\u9884\u671F\u7684key -RunAsImplAuthenticationProvider.incorrectKey=\u5C55\u793A\u7684RunAsUserToken\u4E0D\u542B\u6709\u9884\u671F\u7684key -SubjectDnX509PrincipalExtractor.noMatching=\u672A\u5728subjectDN\: {0}\u4E2D\u627E\u5230\u5339\u914D\u7684\u6A21\u5F0F -SwitchUserFilter.noCurrentUser=\u4E0D\u5B58\u5728\u5F53\u524D\u7528\u6237 -SwitchUserFilter.noOriginalAuthentication=\u4E0D\u80FD\u591F\u67E5\u627E\u5230\u539F\u5148\u7684\u5DF2\u8BA4\u8BC1\u5BF9\u8C61 diff --git a/pig-visual/pig-codegen/pom.xml b/pig-visual/pig-codegen/pom.xml index ed39f48e..e96b77ec 100755 --- a/pig-visual/pig-codegen/pom.xml +++ b/pig-visual/pig-codegen/pom.xml @@ -82,8 +82,8 @@ - velocity org.apache.velocity + velocity-engine-core ${velocity.version} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/CodeGenKits.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/CodeGenKits.java index 2ce74c60..c0d7cde6 100644 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/CodeGenKits.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/CodeGenKits.java @@ -37,6 +37,8 @@ import org.apache.commons.lang.WordUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; +import org.apache.velocity.tools.generic.DateTool; +import org.apache.velocity.tools.generic.MathTool; import java.io.File; import java.io.IOException; @@ -259,7 +261,11 @@ public class CodeGenKits { Properties prop = new Properties(); prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); Velocity.init(prop); + VelocityContext context = new VelocityContext(map); + // 函数库 + context.put("math", new MathTool()); + context.put("dateTool", new DateTool()); // 获取模板列表 List templates = getTemplates(genConfig); diff --git a/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm b/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm index af95d03f..565c5d22 100644 --- a/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm +++ b/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm @@ -1,19 +1,20 @@ --- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点1000 +-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 根节点 +#set($menuId=${dateTool.getSystemTime()}) -- 菜单SQL -insert into `sys_menu` ( `parent_id`, `path`, `permission`, `type`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`) - values ( '1000', '/${moduleName}/${pathName}/index', '', '0', 'icon-bangzhushouji', '0', '2018-01-20 13:17:19', '8', '2018-07-29 13:38:19', '${comments}管理'); - --- 按钮父菜单ID -set @parentId = @@identity; +insert into `sys_menu` (`menu_id`, `parent_id`, `path`, `permission`, `type`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) + values (${menuId}, '-1', '/${moduleName}/${pathName}/index', '', '0', 'icon-bangzhushouji', '0', '2018-01-20 13:17:19', '8', '2018-07-29 13:38:19', '${comments}管理'); -- 菜单对应按钮SQL -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`) - SELECT @parentId, '${moduleName}_${pathName}_get', '1', null, '1', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '${comments}查看'; -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`) - SELECT @parentId, '${moduleName}_${pathName}_add', '1', null, '1', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '${comments}新增'; -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`) - SELECT @parentId, '${moduleName}_${pathName}_edit', '1', null, '1', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '${comments}修改'; -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`) - SELECT @parentId, '${moduleName}_${pathName}_del', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '${comments}删除'; +insert into `sys_menu` ( `parent_id`,`menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) +values(${menuId}, ${math.add($menuId,1)}, '${moduleName}_${pathName}_get', '1', null, '1', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '${comments}查看'); + +insert into `sys_menu` (`parent_id`, `menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) +values(${menuId}, ${math.add($menuId,2)}, '${moduleName}_${pathName}_add', '1', null, '1', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '${comments}新增'); + +insert into `sys_menu` (`parent_id`, `menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) +values(${menuId}, ${math.add($menuId,3)}, '${moduleName}_${pathName}_edit', '1', null, '1', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '${comments}修改'); + +insert into `sys_menu` (`parent_id`, `menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) +values(${menuId}, ${math.add($menuId,4)}, '${moduleName}_${pathName}_del', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '${comments}删除'); diff --git a/pom.xml b/pom.xml index 0b23f261..ab2435e2 100755 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ 5.7.18 3.4.1 2.2.1 - 1.7 + 2.3 1.10 2.0.3 2.1.0