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