按照软件设计文档开始重构代码01
This commit is contained in:
@@ -22,28 +22,28 @@ public class MenuRepository : BaseRepository<DbMenu>,IMenuRepository
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var dbMenuTree = await Db.Queryable<DbMenu>()
|
||||
.ToTreeAsync(dm => dm.Items, dm => dm.ParentId, 0);
|
||||
.ToTreeAsync(dm => dm.Childrens, dm => dm.ParentId, 0);
|
||||
stopwatch.Stop();
|
||||
NlogHelper.Info($"获取菜单树耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return dbMenuTree;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑菜单,支持事务
|
||||
/// </summary>
|
||||
/// <param name="menu"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<DbMenu?> GetMenuByDataIdAsync(int dataId, MenuType menuType)
|
||||
{
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var result = await Db.Queryable<DbMenu>()
|
||||
.FirstAsync(m => m.DataId == dataId && m.Type == menuType);
|
||||
stopwatch.Stop();
|
||||
NlogHelper.Info($"根据DataId '{dataId}' 和 MenuType '{menuType}' 获取菜单耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 编辑菜单,支持事务
|
||||
// /// </summary>
|
||||
// /// <param name="menu"></param>
|
||||
// /// <returns></returns>
|
||||
//
|
||||
// public async Task<DbMenu?> GetMenuByDataIdAsync(int dataId, MenuType menuType)
|
||||
// {
|
||||
// Stopwatch stopwatch = new Stopwatch();
|
||||
// stopwatch.Start();
|
||||
// var result = await Db.Queryable<DbMenu>()
|
||||
// .FirstAsync(m => m.DataId == dataId && m.Type == menuType);
|
||||
// stopwatch.Stop();
|
||||
// NlogHelper.Info($"根据DataId '{dataId}' 和 MenuType '{menuType}' 获取菜单耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user