/// <summary>
        /// 加载其它数据
        /// </summary>
        /// <param name="authoritys">权限数据</param>
        /// <param name="query">筛选条件</param>
        /// <returns></returns>
        List <Authority> LoadOtherObjectData(IEnumerable <Authority> authoritys, IQuery query)
        {
            if (authoritys.IsNullOrEmpty())
            {
                return(new List <Authority>(0));
            }
            if (query == null)
            {
                return(authoritys.ToList());
            }

            #region 权限分组

            List <AuthorityGroup> groupList = null;
            if (query.AllowLoad <Authority>(c => c.Group))
            {
                var groupIds = authoritys.Select(c => c.Group?.SysNo ?? 0).Distinct().ToList();
                groupList = authorityGroupService.GetAuthorityGroupList(groupIds);
            }

            #endregion

            foreach (var auth in authoritys)
            {
                if (auth == null)
                {
                    continue;
                }
                if (!groupList.IsNullOrEmpty())
                {
                    auth.SetGroup(groupList.FirstOrDefault(c => c.SysNo == auth.Group?.SysNo));
                }
            }

            return(authoritys.ToList());
        }
Exemple #2
0
        /// <summary>
        /// 获取权限分组列表
        /// </summary>
        /// <param name="filter">查询对象</param>
        /// <returns></returns>
        public List <AuthorityGroupDto> GetAuthorityGroupList(AuthorityGroupFilterDto filter)
        {
            var authorityGroupList = authorityGroupService.GetAuthorityGroupList(CreateAuthorityGroupQueryObject(filter));

            return(authorityGroupList.Select(c => c.MapTo <AuthorityGroupDto>()).ToList());
        }