using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.DAL
{
///
/// 能效汇总业务周记录
///
public class EtaSumLogicWeekRecord : CorpDAL
{
///
///
///
public override ConnectionConfig ConnectionConfig
{
get { return ConfigHelper.RecordConnectionConfig; }
}
///
/// 通过对象获取
///
public List GetByObject(long CorpID, string ObjectType, long ObjectID)
{
using (var db = new SqlSugarClient(ConnectionConfig))
{
return db.Queryable()
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
.ToList();
}
}
///
/// 通过对象获取某周的数据
///
public List GetByObjectOfWeek(long CorpID, string ObjectType, long ObjectID, DateTime StartDay, DateTime EndDay)
{
using (var db = new SqlSugarClient(ConnectionConfig))
{
return db.Queryable()
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
.Where(x=>x.StartDay==StartDay.Date&&x.EndDay==EndDay.Date)
.ToList();
}
}
///
/// 通过对象获取日期区间内的获取
///
public List GetByObjectOfDayRange(long CorpID, string ObjectType, long ObjectID, DateTime StartDay, DateTime EndDay)
{
using (var db = new SqlSugarClient(ConnectionConfig))
{
return db.Queryable()
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
.Where(x => (x.StartDay>=StartDay.Date&&x.StartDay<=EndDay.Date)
||(x.EndDay>=StartDay.Date&&x.EndDay<=EndDay.Date))
.ToList();
}
}
}
}