From 0aba0eaa489ba9bdfb5ac8a8257d672b218f571c Mon Sep 17 00:00:00 2001 From: lbw Date: Sun, 9 Jan 2022 09:12:26 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=20=E9=80=82=E9=85=8D?= =?UTF-8?q?Oracle=20=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pigx-visual/pigx-codegen/pom.xml | 7 ++++- .../pig4cloud/pigx/codegen/util/GenUtils.java | 5 +++ .../src/main/resources/template/menu.sql.vm | 31 +++++++++++-------- pom.xml | 9 +++--- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/pigx-visual/pigx-codegen/pom.xml b/pigx-visual/pigx-codegen/pom.xml index 7a46d76d8..b4f7a1e7c 100755 --- a/pigx-visual/pigx-codegen/pom.xml +++ b/pigx-visual/pigx-codegen/pom.xml @@ -118,10 +118,15 @@ - velocity org.apache.velocity + velocity-engine-core ${velocity.version} + + org.apache.velocity.tools + velocity-tools-generic + ${velocity.tool.version} + io.springboot.plugin diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java index 16caf4f8a..9daff609b 100644 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java @@ -41,6 +41,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 org.springframework.context.ApplicationContext; import java.io.File; @@ -266,6 +268,9 @@ public class GenUtils { 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/pigx-visual/pigx-codegen/src/main/resources/template/menu.sql.vm b/pigx-visual/pigx-codegen/src/main/resources/template/menu.sql.vm index 6bba5f4c6..f4976108b 100644 --- a/pigx-visual/pigx-codegen/src/main/resources/template/menu.sql.vm +++ b/pigx-visual/pigx-codegen/src/main/resources/template/menu.sql.vm @@ -1,20 +1,25 @@ --- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点1000 , 默认租户 1 +-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点-1 , 默认租户 1 +#set($menuId=${dateTool.getSystemTime()}) -- 菜单SQL -insert into `sys_menu` ( `parent_id`, `path`, `permission`, `type`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) - values ( '1000', '/${moduleName}/${pathName}/index', '', '0', 'icon-bangzhushouji', '0', '2018-01-20 13:17:19', '8', '2018-07-29 13:38:19', '${comments}管理', 1); +insert into `sys_menu` ( `menu_id`,`parent_id`, `path`, `permission`, `type`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) + values (${menuId}, '-1', '/${moduleName}/${pathName}/index', '', '0', 'icon-bangzhushouji', '0', '2018-01-20 13:17:19', '8', '2018-07-29 13:38:19', '${comments}管理', 1); -- 按钮父菜单ID set @parentId = @@identity; -- 菜单对应按钮SQL -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) - SELECT @parentId, '${moduleName}_${pathName}_view', '1', null, '1', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '${comments}查看', 1; -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) - SELECT @parentId, '${moduleName}_${pathName}_add', '1', null, '1', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '${comments}新增', 1; -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) - SELECT @parentId, '${moduleName}_${pathName}_edit', '1', null, '1', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '${comments}修改', 1; -insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) - SELECT @parentId, '${moduleName}_${pathName}_del', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '${comments}删除', 1; - insert into `sys_menu` ( `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) - SELECT @parentId, '${moduleName}_${pathName}_export', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '导入导出', 1; +insert into `sys_menu` ( `menu_id`,`parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) +values (${math.add($menuId,1)},${menuId}, '${moduleName}_${pathName}_view', '1', null, '1', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '${comments}查看', 1); + +insert into `sys_menu` ( `menu_id`,`parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) +values (${math.add($menuId,1)},${menuId}, '${moduleName}_${pathName}_add', '1', null, '1', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '${comments}新增', 1); + +insert into `sys_menu` (`menu_id`, `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) +values (${math.add($menuId,1)},${menuId}, '${moduleName}_${pathName}_edit', '1', null, '1', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '${comments}修改', 1); + +insert into `sys_menu` (`menu_id`, `parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) +values (${math.add($menuId,1)},${menuId}, '${moduleName}_${pathName}_del', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '${comments}删除', 1); + +insert into `sys_menu` ( `menu_id`,`parent_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort`, `update_time`, `name`, `tenant_id`) + values (${math.add($menuId,1)},${menuId}, '${moduleName}_${pathName}_export', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '导入导出', 1); diff --git a/pom.xml b/pom.xml index 9de2718c0..abd5994d4 100644 --- a/pom.xml +++ b/pom.xml @@ -33,8 +33,8 @@ - 2.5.8 - 2020.0.4 + 2.6.2 + 2021.0.0 2021.1 UTF-8 1.8 @@ -42,13 +42,14 @@ 3.8.1 0.0.28 2.2.5 - 2.5.5 + 2.6.0 5.7.18 1.2.7 3.6.4 3.0.0 2.0.9 - 1.7 + 2.3 + 3.1 4.1.0 3.0.3 2.11.4