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 EtaStandardLogicYearRecord : CorpDAL<Entity.EtaStandardLogicYearRecord>
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return ConfigHelper.RecordConnectionConfig; }
|
}
|
|
/// <summary>
|
/// 通过对象获取
|
/// </summary>
|
public List<Entity.EtaStandardLogicYearRecord> GetByObject(long CorpID, string ObjectType, long ObjectID)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaStandardLogicYearRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过对象获取某年的数据数据
|
/// </summary>
|
public List<Entity.EtaStandardLogicYearRecord> GetByObjectOfYear(long CorpID, string ObjectType, long ObjectID, int Year)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaStandardLogicYearRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
|
.Where(x => x.DataYear == Year)
|
.ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过对象获取年区间内的数据
|
/// </summary>
|
public List<Entity.EtaStandardLogicYearRecord> GetByObjectOfYearRange(long CorpID, string ObjectType, long ObjectID, int StartYear, int EndYear)
|
{
|
if (StartYear > EndYear)
|
return default;
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.EtaStandardLogicYearRecord>()
|
.Where(x => x.CorpID == CorpID && x.ObjectType == ObjectType && x.ObjectID == ObjectID)
|
.Where(x => x.DataYear >= StartYear && x.DataYear <= EndYear)
|
.ToList();
|
}
|
}
|
|
|
}
|
}
|