duheng
2025-03-28 e411302bca8857e102443a5250c82b9580ef07a3
Service/HStation.Service.PhartRelation.Core/05-service/01-relation/PhartDiagramRelation.cs
@@ -1,7 +1,4 @@
using System;
using Yw.Service;
namespace HStation.Service
namespace HStation.Service
{
    /// <summary>
    /// 图表关联
@@ -129,6 +126,19 @@
            }
            var all = GetAll();
            return all.Where(x => Ids.Contains(x.ID)).OrderBy(x => x.SortCode).ToList();
        }
        /// <summary>
        /// 通过 DiagramID 获取
        /// </summary>
        public List<Model.PhartDiagramRelation> GetByDiagramID(long DiagramID)
        {
            if (DiagramID < 1)
            {
                return default;
            }
            var all = GetAll();
            return all.Where(x => x.DiagramID == DiagramID).OrderBy(x => x.SortCode).ToList();
        }
        /// <summary>
@@ -570,12 +580,24 @@
        {
            Msg = string.Empty;
            var dal = DALCreateHelper.CreateDAL<DAL.IPhartDiagramRelation>();
            var bol = dal.DeleteByID(ID);
            if (bol)
            var entity = dal.GetByID(ID);
            if (entity == null)
                return false;
            var models = GetByDiagramID(entity.DiagramID);
            if (models != null && models.Count > 1)
            {
                RemoveCache(ID);
                var bol = dal.DeleteByID(ID);
                if (bol)
                {
                    RemoveCache(ID);
                }
                return bol;
            }
            return bol;
            else
            {
                return DeleteByDiagramID(entity.DiagramID, out Msg);
            }
        }
        /// <summary>