START TRANSACTION;

-- 目录ID
set @pId = 目录ID;
-- 菜单ID
set @menuId = 菜单ID;

-- 插入菜单
INSERT INTO `sys_permission`
    (`id`, `parent_id`, `title`, `code`, `path`, `router_name`, `component`, `redirect`,  `icon`, `sort`, `keep_alive`, `hidden`, `type`, `del_flag`, `create_time`, `update_time`)
VALUES
    (@menuId, @pId, '${comments}', NULL, '/${moduleName}/${pathName}', '${classname}', '${moduleName}/${pathName}/${className}Page', NULL, NULL, 1, 0, 0, 1, 0, NULL, '2019-10-13 22:00:24');


-- 菜单对应按钮SQL
INSERT INTO `sys_permission` ( `id`, `parent_id`,`title`, `code`, `sort`, `type`, `del_flag`, `create_time`, `update_time` )
VALUES
( @menuId + 1, @menuId, '${comments}新增', '${moduleName}_${pathName}_add',  0, 2, 0, '2019-10-13 22:00:24', NULL );

INSERT INTO `sys_permission` ( `id`, `parent_id`,`title`, `code`, `sort`, `type`, `del_flag`, `create_time`, `update_time` )
VALUES
( @menuId + 2, @menuId, '${comments}修改', '${moduleName}_${pathName}_edit', 1, 2, 0, '2019-10-13 22:00:24', NULL );

INSERT INTO `sys_permission` ( `id`, `parent_id`,`title`, `code`, `sort`, `type`, `del_flag`, `create_time`, `update_time` )
VALUES
( @menuId + 3, @menuId, '${comments}删除', '${moduleName}_${pathName}_del', 2, 2, 0, '2019-10-13 22:00:24', NULL );

-- 清空变量
set @menuId = null;
set @pId = null;

COMMIT;