using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using SqlSugar;
|
|
|
namespace IStation.DAL
|
{
|
/// <summary>
|
/// 物联卡缴费记录
|
/// </summary>
|
public partial class IotPaymentRecord : CorpDAL<Entity.IotPaymentRecord>
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return ConfigHelper.DefaultConnectionConfig; }
|
}
|
|
/// <summary>
|
/// 通过 ProductID 获取
|
/// </summary>
|
public List<Entity.IotPaymentRecord> GetByProductID(long CorpID, long ProductID)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.IotPaymentRecord>().Where(x => x.CorpID == CorpID && x.ProductID == ProductID).ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过 ProductIds 获取
|
/// </summary>
|
public List<Entity.IotPaymentRecord> GetByProductIds(long CorpID, List<long> ProductIds)
|
{
|
if (ProductIds == null || ProductIds.Count < 1)
|
return default;
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.IotPaymentRecord>().Where(x => x.CorpID == CorpID && ProductIds.Contains(x.ProductID)).ToList();
|
}
|
}
|
|
/// <summary>
|
/// 通过 BelongType 和 BelongID 获取
|
/// </summary>
|
public List<Entity.IotPaymentRecord> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID)
|
{
|
using (var db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Queryable<Entity.IotPaymentRecord, Entity.Product>((x, y) => x.ProductID == y.ID)
|
.Where((x, y) => y.CorpID == CorpID && y.BelongType == BelongType && y.BelongID == BelongID)
|
.Select(x => x).ToList();
|
}
|
}
|
|
|
}
|
}
|