From 1f3791409ca53694d4c178474b0029184649bcca Mon Sep 17 00:00:00 2001 From: peishaopeng Date: Thu, 26 Oct 2023 00:02:06 +0800 Subject: [PATCH] =?UTF-8?q?:necktie:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=B7=BB=E5=8A=A0=E6=96=B0=E4=BB=A3=E7=A0=81=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/me/zhengjie/utils/GenUtil.java | 5 +++++ eladmin-generator/src/main/resources/template/admin/Sql.ftl | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 eladmin-generator/src/main/resources/template/admin/Sql.ftl diff --git a/eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java b/eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java index 8c8a95aa..8fbcb954 100644 --- a/eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java +++ b/eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java @@ -64,6 +64,7 @@ public class GenUtil { templateNames.add("Service"); templateNames.add("ServiceImpl"); templateNames.add("Repository"); + templateNames.add("Sql"); return templateNames; } @@ -386,6 +387,10 @@ public class GenUtil { return packagePath + "repository" + File.separator + className + "Repository.java"; } + if ("Sql".equals(templateName)) { + return packagePath + "sql" + File.separator + className + ".sql"; + } + return null; } diff --git a/eladmin-generator/src/main/resources/template/admin/Sql.ftl b/eladmin-generator/src/main/resources/template/admin/Sql.ftl new file mode 100644 index 00000000..d2c7b8e0 --- /dev/null +++ b/eladmin-generator/src/main/resources/template/admin/Sql.ftl @@ -0,0 +1,5 @@ +INSERT INTO `eladmin`.`sys_menu` (`pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (1, 3, 1, '${apiAlias}管理', '${className}', 'system/${changeClassName}/index', 990, 'menu', '${changeClassName}', b'0', b'0', b'0', '${changeClassName}:list', NULL, NULL, NOW(), NULL); +SET @last_id_in_table1 = LAST_INSERT_ID(); +INSERT INTO `eladmin`.`sys_menu` (`pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (@last_id_in_table1, 0, 2, '${apiAlias}新增', NULL, NULL, 1, NULL, NULL, b'0', b'0', b'0', '${changeClassName}:add', NULL, NULL, NOW(), NULL); +INSERT INTO `eladmin`.`sys_menu` (`pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (@last_id_in_table1, 0, 2, '${apiAlias}编辑', NULL, NULL, 1, NULL, NULL, b'0', b'0', b'0', '${changeClassName}:edit', NULL, NULL, NOW(), NULL); +INSERT INTO `eladmin`.`sys_menu` (`pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (@last_id_in_table1, 0, 2, '${apiAlias}删除', NULL, NULL, 1, NULL, NULL, b'0', b'0', b'0', '${changeClassName}:del', NULL, NULL, NOW(), NULL);