示例#1
0
        /// <summary>
        ///     根据组织机构获取组信息
        /// </summary>
        /// <param name="input">组织机构</param>
        /// <returns></returns>
        public async Task <IEnumerable <SystemGroupOutput> > GetGroupByOrganizationId(SystemGroupGetGroupByOrganizationIdInput input)
        {
            var groups  = (await _groupRepository.GetGroupByOrganizationId(input)).ToList();
            var allOrgs = (await _organizationRepository.FindAllAsync()).ToList();

            foreach (var group in groups)
            {
                group.BelongToName = EnumUtil.GetName(typeof(EnumGroupBelongTo), group.BelongTo);
                var organization = allOrgs.FirstOrDefault(w => w.OrganizationId == group.OrganizationId);
                if (organization != null && !organization.ParentIds.IsNullOrEmpty())
                {
                    foreach (var parent in organization.ParentIds.Split(','))
                    {
                        //查找上级
                        var dicinfo = allOrgs.FirstOrDefault(w => w.OrganizationId.ToString() == parent);
                        if (dicinfo != null)
                        {
                            group.OrganizationNames += dicinfo.Name + ">";
                        }
                    }
                    if (!group.OrganizationNames.IsNullOrEmpty())
                    {
                        group.OrganizationNames = group.OrganizationNames.TrimEnd('>');
                    }
                }
            }
            return(groups);
        }
示例#2
0
        /// <summary>
        ///     根据组织机构获取组信息
        /// </summary>
        /// <param name="input">组织机构</param>
        /// <returns></returns>
        public async Task <IEnumerable <SystemGroupOutput> > GetGroupByOrganizationId(NullableIdInput input)
        {
            var groups = (await _groupRepository.GetGroupByOrganizationId(input)).ToList();

            //获取组织机构信息
            foreach (var group in groups)
            {
                group.BelongToName = EnumUtil.GetName(typeof(EnumGroupBelongTo), group.BelongTo);
            }
            return(groups);
        }