using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace IStation.DAL
|
{
|
/// <summary>
|
/// 能效业务实时记录
|
/// </summary>
|
public class EtaLogicRealRecord:CorpDAL<Entity.EtaLogicRealRecord>
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return ConfigHelper.RecordConnectionConfig; }
|
}
|
|
/// <summary>
|
/// 通过 CorpID 获取某日的数据
|
/// </summary>
|
public List<Entity.EtaLogicRealRecord> GetByCorpIDOfDay(long CorpID, DateTime Day)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaLogicRealRecord>()
|
.Where(x => x.CorpID == CorpID && x.DataTime >= Day.Date && x.DataTime < Day.Date.AddDays(1))
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过 Object 获取某日的数据
|
/// </summary>
|
public List<Entity.EtaLogicRealRecord> GetByObjectOfDay(long CorpID, string ObjectType, long ObjectID, DateTime Day)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaLogicRealRecord>()
|
.Where(x=>x.CorpID==CorpID&&x.ObjectType==ObjectType&&x.ObjectID==ObjectID&&x.DataTime>=Day.Date&&x.DataTime<Day.Date.AddDays(1))
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 获取 Object 获取日期区间内的数据
|
/// </summary>
|
public List<Entity.EtaLogicRealRecord> GetByObjectOfDayRange(long CorpID, string ObjectType, long ObjectID, DateTime StartDay, DateTime EndDay)
|
{
|
if (StartDay.Date>EndDay.Date)
|
{
|
return default;
|
}
|
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaLogicRealRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID && x.DataTime >= StartDay.Date && x.DataTime < EndDay.Date.AddDays(1))
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 获取 Object 时间区间内的数据
|
/// </summary>
|
public List<Entity.EtaLogicRealRecord> GetByObjectOfTimeRange(long CorpID, string ObjectType, long ObjectID, DateTime StartTime, DateTime EndTime)
|
{
|
if (StartTime > EndTime)
|
{
|
return default;
|
}
|
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaLogicRealRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID && x.DataTime >= StartTime && x.DataTime < EndTime)
|
.ToList();
|
}
|
}
|
|
|
|
|
|
|
|
|
|
}
|
}
|