/// <summary> /// 根据Ids获取菜单授权集合 /// </summary> /// <param name="ids">菜单编号集合</param> /// <returns></returns> public async Task <List <MenuAppAuthorize> > GetMenuAppAuthorizeListByIdsAsync(List <long> ids) { var predicate = new PredicateGroup <MenuAppAuthorize>(); predicate.AddPredicate(true, s => ids.Contains(s.Id)); return(await _repository.QueryAsync(predicate.Predicates)); }
/// <summary> /// 根据names获取角色集合 /// </summary> /// <param name="names">角色名称集合</param> /// <returns></returns> public async Task <List <Role> > GetRoleListByNamesAsync(List <string> names) { var predicate = new PredicateGroup <Role>(); predicate.AddPredicate(true, s => names.Contains(s.Name)); return(await _roleRepository.QueryAsync(predicate.Predicates)); }
/// <summary> /// 根据后台用户Id获取用户实体 /// </summary> /// <returns></returns> public async Task <Manager> GetManagerByIdAsync(long managerId, List <string> includeNames) { var predicate = new PredicateGroup <Manager>(); predicate.AddPredicate(true, s => s.Id == managerId); var managerList = await _managerRepository.QueryAsync( predicate.Predicates, includeNames); return(managerList.FirstOrDefault()); }
/// <summary> /// 获取菜单列表 /// </summary> /// <param name="where"></param> /// <returns></returns> public async Task <List <Menu> > GetMenuListAsync(Expression <Func <Menu, bool> > where) { var predicate = new PredicateGroup <Menu>(); predicate.AddPredicate(where != null, where); var list = await _menuRepository.QueryAsync(predicate.Predicates, " Sort Asc"); var menus = list.Where(m => m.ParentId == null).ToList(); return(GetTreeMenuList(menus)); }
/// <summary> /// 获取用户 /// <remarks>如果没有查询到用户信息返回null</remarks> /// </summary> /// <returns></returns> public async Task <UserBase> GetUserBaseByIdAsync(long userId, List <string> includeNames = null) { var predicate = new PredicateGroup <UserBase>(); predicate.AddPredicate(true, x => x.Id == userId && !x.IsLockoutEnaled); var userBases = await _userBaseRepository.QueryAsync( predicate.Predicates, includeNames); return(userBases.FirstOrDefault()); }
/// <summary> /// 根据会员Id获取会员信息 /// </summary> public async Task <Member> GetMemberByUserBaseIdAsync(long userBaseId) { var predicate = new PredicateGroup <Member>(); predicate.AddPredicate(true, s => s.UserId == userBaseId); var managerList = await _memberRepository.QueryAsync(predicate.Predicates); return(managerList.FirstOrDefault()); }