Files
Yi.Framework/Yi.Framework.Net6/Yi.Framework.Service/MenuService.cs
2022-04-26 18:29:18 +08:00

20 lines
610 B
C#

using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class MenuService : BaseService<MenuEntity>, IMenuService
{
public async Task<List<MenuEntity>> GetMenuTreeAsync()
{
//ParentId 0,代表为根目录,只能存在一个
//复杂查询直接使用db代理
return await _repository._Db.Queryable<MenuEntity>().ToTreeAsync(it=>it.Children,it=>it.ParentId,0);
}
}
}