You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

using System.Linq.Expressions;
7 months ago
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
7 months ago
using SqlSugar;
namespace Repository.Station;
[Scope("SingleInstance")]
public class ChargeOrderRepository : BaseRepository<ChargeOrder>
{
public ChargeOrderRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
{
}
public IPage<ChargeOrder> QueryIPage(QueryPageModel page, Expression<Func<ChargeOrder, bool>> predicate)
{
if (null == predicate)
{
return QueryPage(page);
}
int totalCount = 0;
List<ChargeOrder> pageList = DbBaseClient
.Queryable<ChargeOrder>()
.Where(predicate)
.OrderByDescending(x => x.CreatedTime)
.WithNoLockOrNot(false)
.ToPageList(page.PageNum, page.PageSize, ref totalCount);
return new IPage<ChargeOrder>(totalCount, page, pageList);
}
/// <summary>
/// 查询需要导出充电订单
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public async Task<List<ChargeOrder>> QueryChargeOrderList(Expression<Func<ChargeOrder, bool>> predicate)
{
if (predicate == null)
{
return await QueryAsync();
}
List<ChargeOrder> resultList = await DbBaseClient
.Queryable<ChargeOrder>()
.Where(predicate)
.WithNoLockOrNot(false)
.ToListAsync();
return resultList;
}
public IPage<ChargeOrder> QueryPage(QueryPageModel page)
{
int totalCount = 0;
List<ChargeOrder> pageList = DbBaseClient
.Queryable<ChargeOrder>()
.OrderByDescending(x => x.CreatedTime)
.WithNoLockOrNot(false)
.ToPageList(page.PageNum, page.PageSize, ref totalCount);
return new IPage<ChargeOrder>(totalCount, page, pageList);
}
7 months ago
}