1
lixiaojun
2025-01-03 754a5cd2a8b2a76e1c00cc45c89457eeb74637bf
BLL/HStation.BLL.PhartRelation.Core/02-httpclient/01-relation/PhartDiagramRelation.cs
@@ -1,65 +1,173 @@
using Yw.CAL.HttpClient;
using Yw.Dto;
namespace HStation.CAL.HttpClient
{
    /// <summary>
    /// 图表关联
    ///</summary>
    public class PhartDiagramRelation : BaseCAL_Sorter<AddPhartDiagramRelationInput, UpdatePhartDiagramRelationInput, PhartDiagramRelationDto>, IPhartDiagramRelation
    ///
    /// </summary>
    public class PhartDiagramRelation : BaseCAL_Paras_Flags_TagName_Sorter<AddPhartDiagramRelationInput, UpdatePhartDiagramRelationInput, PhartDiagramRelationDto>, IPhartDiagramRelation
    {
        protected override string Prefix
        {
            get { return $"{BLL.PhartRelation.ConfigHelper.HttpUrl}/PhartDiagramRelation"; }
            get { return $"{HStation.BLL.PhartRelation.ConfigHelper.HttpUrl}/PhartRelation/PhartDiagramRelation"; }
        }
        #region Query
        /// <summary>
        /// 通过 ID 获取
        /// </summary>
        public async Task<PhartDiagramRelationExtensionsDto> GetExByID(long ID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ID),ID),
            };
            return await GetUrl("GetExByID@V1.0").Get<PhartDiagramRelationExtensionsDto>(paras);
        }
        public Task<List<PhartDiagramRelationExtensionsDto>> GetExByObjectTypeAndObjectID(string ObjectType, string ObjectID)
        /// <summary>
        /// 通过 Ids 获取
        /// </summary>
        public async Task<List<PhartDiagramRelationExtensionsDto>> GetExByIds(List<long> Ids)
        {
            throw new NotImplementedException();
        }
        public Task<PhartDiagramRelationExtensionsDto> GetDefaultExByObjectTypeAndObjectID(string ObjectType, string ObjectID)
        {
            throw new NotImplementedException();
        }
        public Task<long> InsertEx(PhartDiagramRelationDto relation, PhartDiagramDto diagram, List<PhartGraphDto> graphList)
        {
            throw new NotImplementedException();
        }
        public Task<bool> UpdateDescription(long ID, string Description)
        {
            throw new NotImplementedException();
        }
        public Task<bool> UpdateEx(PhartDiagramRelationDto relation, PhartDiagramDto diagram, List<PhartGraphDto> graphList)
        {
            throw new NotImplementedException();
        }
        public Task<bool> UpdateImportance(long ID, int Importance)
        {
            throw new NotImplementedException();
        }
        public Task<bool> UpdateOtherName(long ID, string OtherName)
        {
            throw new NotImplementedException();
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(Ids),Ids),
            };
            return await GetUrl("GetExByIds@V1.0").Get<List<PhartDiagramRelationExtensionsDto>>(paras);
        } 
        public Task<bool> DeleteByDiagramID(long DiagramID)
        /// <summary>
        /// 通过 ObjectType ObjectID 获取
        /// </summary>
        public async Task<List<PhartDiagramRelationExtensionsDto>> GetExByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            throw new NotImplementedException();
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ObjectType),ObjectType),
                (nameof(ObjectID),ObjectID),
            };
            return await GetUrl("GetExByObjectTypeAndObjectID@V1.0").Get<List<PhartDiagramRelationExtensionsDto>>(paras);
        }
        public Task<bool> DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        /// <summary>
        /// 通过 ObjectType ObjectID 获取 Default
        /// </summary>
        public async Task<PhartDiagramRelationExtensionsDto> GetDefaultExByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            throw new NotImplementedException();
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ObjectType),ObjectType),
                (nameof(ObjectID),ObjectID),
            };
            return await GetUrl("GetDefaultExByObjectTypeAndObjectID@V1.0").Get<PhartDiagramRelationExtensionsDto>(paras);
        }
        /// <summary>
        /// 获取最大排序码
        /// </summary>
        public async Task<int> GetMaxSortCode()
        {
            return await GetUrl("GetMaxSortCode@V1.0").Get<int>();
        }
        #endregion
        #region Insert
        /// <summary>
        /// 插入拓展
        /// </summary>
        public async Task<long> InsertEx(PhartDiagramRelationDto relation, Yw.Dto.PhartDiagramDto diagram, List<Yw.Dto.PhartGraphDto> graphList)
        {
            var modelRelation = relation.Adapt<HStation.Model.PhartDiagramRelation>();
            var modelDiagram = diagram.Adapt<Yw.Model.PhartDiagram>();
            var modelGraphList = graphList.Adapt<List<Yw.Model.PhartGraph>>();
            var paras = new Dto.PhartDiagramRelationExtensionsDto(modelRelation, modelDiagram, modelGraphList);
            return await GetUrl("InsertEx@V1.0").Post<long>(paras);
        }
        #endregion Insert
        #region Update
        /// <summary>
        /// 更新拓展
        /// </summary>
        public async Task<bool> UpdateEx(PhartDiagramRelationDto relation, Yw.Dto.PhartDiagramDto diagram, List<Yw.Dto.PhartGraphDto> graphList)
        {
            var modelRelation = relation.Adapt<HStation.Model.PhartDiagramRelation>();
            var modelDiagram = diagram.Adapt<Yw.Model.PhartDiagram>();
            var modelGraphList = graphList.Adapt<List<Yw.Model.PhartGraph>>();
            var paras = new Dto.PhartDiagramRelationExtensionsDto(modelRelation, modelDiagram, modelGraphList);
            return await GetUrl("UpdateEx@V1.0").Put<bool>(paras);
        }
        /// <summary>
        /// 更新 OtherName
        /// </summary>
        public async Task<bool> UpdateOtherName(long ID, string OtherName)
        {
            var paras = new { ID, OtherName };
            return await GetUrl("UpdateOtherName@V1.0").Put<bool>(paras);
        }
        /// <summary>
        /// 更新 Importance
        /// </summary>
        public async Task<bool> UpdateImportance(long ID, int Importance)
        {
            var paras = new { ID, Importance };
            return await GetUrl("UpdateImportance@V1.0").Put<bool>(paras);
        }
        /// <summary>
        /// 更新 Description
        /// </summary>
        public async Task<bool> UpdateDescription(long ID, string Description)
        {
            var paras = new { ID, Description };
            return await GetUrl("UpdateDescription@V1.0").Put<bool>(paras);
        }
        #endregion Update
        #region Delete
        /// <summary>
        /// 通过 ObjectType ObjectID 删除
        /// </summary>
        public async Task<bool> DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(ObjectType),ObjectType),
                (nameof(ObjectID),ObjectID),
            };
            return await GetUrl("DeleteByObjectTypeAndObjectID@V1.0").Delete<bool>(paras);
        }
        /// <summary>
        /// 通过 DiagramID 删除所有映射、图表、图形
        /// </summary>
        public async Task<bool> DeleteByDiagramID(long DiagramID)
        {
            var paras = new List<(string Name, object Value)>()
            {
                (nameof(DiagramID),DiagramID),
            };
            return await GetUrl("DeleteByDiagramID@V1.0").Delete<bool>(paras);
        }
        #endregion
    }
}
}