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 EtaStandardLogicWeekRecord : CorpDAL<Entity.EtaStandardLogicWeekRecord>
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return ConfigHelper.RecordConnectionConfig; }
|
}
|
|
|
/// <summary>
|
/// 通过对象获取
|
/// </summary>
|
public List<Entity.EtaStandardLogicWeekRecord> GetByObject(long CorpID, string ObjectType, long ObjectID)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaStandardLogicWeekRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过对象获取某周的数据
|
/// </summary>
|
public List<Entity.EtaStandardLogicWeekRecord> GetByObjectOfWeek(long CorpID, string ObjectType, long ObjectID, DateTime StartDay, DateTime EndDay)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaStandardLogicWeekRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
|
.Where(x => x.StartDay == StartDay.Date && x.EndDay == EndDay.Date)
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过对象获取日期区间内的获取
|
/// </summary>
|
public List<Entity.EtaStandardLogicWeekRecord> GetByObjectOfDayRange(long CorpID, string ObjectType, long ObjectID, DateTime StartDay, DateTime EndDay)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaStandardLogicWeekRecord>()
|
.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();
|
}
|
}
|
|
}
|
}
|