From 6b9aaaf893a5dbb2860aad294667746e845928cc Mon Sep 17 00:00:00 2001 From: peishaopeng Date: Wed, 1 Nov 2023 11:10:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:necktie:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90-=E7=94=9F=E6=88=90=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=8F=9C=E5=8D=95Sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/me/zhengjie/utils/GenUtil.java | 3 +++ eladmin-generator/src/main/resources/template/admin/Sql.ftl | 5 +++++ 2 files changed, 8 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..a53f6c9f 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; } @@ -341,6 +342,8 @@ public class GenUtil { genMap.put("betweens", betweens); // 保存非空字段信息 genMap.put("isNotNullColumns", isNotNullColumns); + // 添加前端组件路径 + genMap.put("apiPath", genConfig.getApiPath()); return genMap; } 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..fdffcf18 --- /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 (NULL, 3, 1, '${apiAlias}管理', '${className}', '${apiPath}index', 1, '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); \ No newline at end of file From b1d932bf53c6c32716b187c19bc2e6009b3d3451 Mon Sep 17 00:00:00 2001 From: peishaopeng Date: Wed, 1 Nov 2023 11:11:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:fire:=20=E5=88=A0=E9=99=A4=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96sql=E4=B8=ADsys=5Froles=5Fmenus=E8=A1=A8?= =?UTF-8?q?=E5=9E=83=E5=9C=BE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/eladmin.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/eladmin.sql b/sql/eladmin.sql index 20ee0949..2711d6e9 100644 --- a/sql/eladmin.sql +++ b/sql/eladmin.sql @@ -615,7 +615,6 @@ INSERT INTO `sys_roles_menus` VALUES (112, 1); INSERT INTO `sys_roles_menus` VALUES (113, 1); INSERT INTO `sys_roles_menus` VALUES (114, 1); INSERT INTO `sys_roles_menus` VALUES (116, 1); -INSERT INTO `sys_roles_menus` VALUES (120, 1); INSERT INTO `sys_roles_menus` VALUES (1, 2); INSERT INTO `sys_roles_menus` VALUES (2, 2); INSERT INTO `sys_roles_menus` VALUES (6, 2); From bdd69b5f52abda15dd9f56b3c9b103123b96ea5a Mon Sep 17 00:00:00 2001 From: peishaopeng Date: Wed, 1 Nov 2023 11:19:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:necktie:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90-=E7=94=9F=E6=88=90=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=8F=9C=E5=8D=95Sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/me/zhengjie/utils/GenUtil.java | 4 ++++ 1 file changed, 4 insertions(+) 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 a53f6c9f..e86d455b 100644 --- a/eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java +++ b/eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java @@ -389,6 +389,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; }