按照软件设计文档开始重构代码01

This commit is contained in:
2025-07-21 14:35:17 +08:00
parent a7b0a5d108
commit 29a2d44319
127 changed files with 12265 additions and 1586 deletions

View File

@@ -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;
// }
}