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