1
ningshuxia
2023-04-13 df27c5419af98c9bd179cb3d1fe42251458db107
Service/IStation.Service.Basic/catalog/Catalog.cs
@@ -115,6 +115,24 @@
            return all.Where(x => x.ObjectType == ObjectType).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList();
        }
        /// <summary>
        /// 通过 ID 获取子项及自身
        /// </summary>
        public List<Model.Catalog> GetChildAndSelfByID(long CorpID, long ID)
        {
            var all = GetByCorpID(CorpID);
            return all.Where(x => x.ID == ID || x.ParentIds.Contains(ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList();
        }
        /// <summary>
        /// 通过 ID 获取子项
        /// </summary>
        public List<Model.Catalog> GetChildrenByID(long CorpID, long ID)
        {
            var all = GetByCorpID(CorpID);
            return all.Where(x => x.ParentIds.Contains(ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList();
        }
        #endregion
@@ -283,6 +301,28 @@
            return all.Exists(x => x.ID == ID);
        }
        /// <summary>
        /// 判断 Identifier 是否存在
        /// </summary>
        public bool IsExistIdentifier(long CorpID, string Identifier)
        {
            if (string.IsNullOrEmpty(Identifier))
                return false;
            var all = GetByCorpID(CorpID);
            return all.Exists(x=>x.Identifier==Identifier);
        }
        /// <summary>
        /// 判断 Identifier 排除ID是否存在
        /// </summary>
        public bool IsExistIdentifierExceptID(long CorpID, string Identifier, long ID)
        {
            if (string.IsNullOrEmpty(Identifier))
                return false;
            var all = GetByCorpID(CorpID);
            return all.Exists(x => x.Identifier == Identifier&&x.ID!=ID);
        }
        #endregion
        #region Delete