fix 代码生成选择上级菜单bug

This commit is contained in:
不做码农
2021-11-28 17:40:43 +08:00
parent 81a91f13b6
commit aaff546de4
8 changed files with 28 additions and 16 deletions

View File

@@ -231,7 +231,7 @@ namespace ZR.Admin.WebApi.Controllers
}
/// <summary>
/// 生成代码
/// 生成代码(下载方式)
/// </summary>
/// <param name="dto">数据传输对象</param>
/// <returns></returns>
@@ -249,12 +249,7 @@ namespace ZR.Admin.WebApi.Controllers
var genTableInfo = GenTableService.GetGenTableInfo(dto.TableId);
genTableInfo.Columns = GenTableColumnService.GenTableColumns(dto.TableId);
//附加参数keyvalue格式
if (!string.IsNullOrEmpty(genTableInfo.Options))
{
Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(genTableInfo.Options);
dto.ParentMenuId = (long)options.GetValueOrDefault("parentMenuId", 0);
}
dto.GenTable = genTableInfo;
//生成代码
CodeGeneratorTool.Generate(genTableInfo, dto);

View File

@@ -1,6 +1,6 @@
-- 菜单
INSERT INTO sys_menu(menuName, parentId, orderNum, path, component, isFrame, isCache, menuType, visible, status, perms, icon, create_by, create_time, remark)
VALUES ('{FunctionName}', 0, 1, '{ModuleName}/{ModelTypeName}', '{ModuleName}/{ViewsFileName}/index', 0, 0, 'C', '0', '0', '{Permission}:list', 'icon1', '', sysdate(), '{FunctionName}菜单');
VALUES ('{FunctionName}', {ParentId}, 1, '{ModuleName}/{ModelTypeName}', '{ModuleName}/{ViewsFileName}/index', 0, 0, 'C', '0', '0', '{Permission}:list', 'icon1', '', sysdate(), '{FunctionName}菜单');
-- 按钮父菜单id
SELECT @menuId := LAST_INSERT_ID();