using ERP.Core.Entities; using ERP.Framework.WebApi; namespace ERP.Core.Repositorys { public class SysMenuRepository : BaseRepository { public SysMenuRepository(CoreDbContext context) : base(context) { } public List SelectMenuListByUserId(long userId) { var q = from m in Context.Set() join rm in Context.Set() on m.Id equals rm.RoleId join r in Context.Set() on rm.RoleId equals r.Id join ru in Context.Set() on r.Id equals ru.RoleId join u in Context.Set() on ru.UserId equals u.Id where u.Id == userId select m; return q.ToList(); } public List SelectPermissionsByRoleIds(List roleIds) { var q = from rm in Context.Set() join m in Context.Set() on rm.MenuId equals m.Id where roleIds.Contains(rm.RoleId) select m.Permission; return q.ToList(); } } }