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

@@ -1,5 +1,6 @@
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -53,7 +54,24 @@ namespace ZR.Service.System
/// <returns></returns>
public GenTable GetGenTableInfo(long tableId)
{
return GenTableRepository.GetId(tableId);
var info = GenTableRepository.GetId(tableId);
SetTableFromOptions(info);
return info;
}
/// <summary>
/// 设置代码生成其他参数
/// </summary>
/// <param name="genTable"></param>
private void SetTableFromOptions(GenTable genTable)
{
//附加参数keyvalue格式
if (!string.IsNullOrEmpty(genTable?.Options))
{
Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(genTable.Options);
genTable.ParentMenuId = Convert.ToString(options.GetValueOrDefault("parentMenuId"));
}
}
/// <summary>