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