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