using System.Collections.Generic; using System.Data; using System.Linq; using System.Threading.Tasks; using SqlSugar; namespace IStation.DAL { /// /// 信号 /// public partial class Signal : CorpDAL_Sorter { /// /// /// public override ConnectionConfig ConnectionConfig { get { return ConfigHelper.DefaultConnectionConfig; } } /// /// 通过 MonitorPointID 获取 /// public List GetByMonitorPointID(long CorpID, long MonitorPointID) { using (var db = new SqlSugarClient(ConnectionConfig)) { return db.Queryable() .Where(x => x.CorpID == CorpID&&x.MonitorPointID==MonitorPointID).ToList(); } } /// /// 通过 MonitorPointIds 获取 /// public List GetByMonitorPointIds(long CorpID, List MonitorPointIds) { if (MonitorPointIds == null || MonitorPointIds.Count() < 1) return default; using (var db = new SqlSugarClient(ConnectionConfig)) { return db.Queryable() .Where(x => x.CorpID == CorpID && MonitorPointIds.Contains(x.MonitorPointID)).ToList(); } } /// /// 通过 MonitorPointID 删除 /// public bool DeleteByMonitorPointID(long CorpID, long MonitorPointID) { using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig)) { return db.Deleteable() .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID) .ExecuteCommand() > 0; } } } }