🐛 Fixing a bug. 代码生成主键类型不匹配

This commit is contained in:
lbw 2022-01-07 11:36:59 +08:00
parent 984c0bb6b0
commit 1b93235b72
7 changed files with 24 additions and 186 deletions

View File

@ -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- 关闭',

View File

@ -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;

View File

@ -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

View File

@ -82,8 +82,8 @@
</dependency>
<!--代码生成模板引擎-->
<dependency>
<artifactId>velocity</artifactId>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<!--undertow容器-->

View File

@ -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<String> templates = getTemplates(genConfig);

View File

@ -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}删除');

View File

@ -37,7 +37,7 @@
<hutool.version>5.7.18</hutool.version>
<dynamic-ds.version>3.4.1</dynamic-ds.version>
<captcha.version>2.2.1</captcha.version>
<velocity.version>1.7</velocity.version>
<velocity.version>2.3</velocity.version>
<configuration.version>1.10</configuration.version>
<nacos.version>2.0.3</nacos.version>
<jasypt.version>2.1.0</jasypt.version>