using Edu.Model.Entity.Customer;
using Edu.Model.ViewModel.Customer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Customer
{
///
/// 客户完成任务和订单关联仓储层
///
public class RB_Customer_FinishdetailsRepository : BaseRepository
{
///
/// 获取任务和订单关联列表
///
///
///
///
///
///
public List GetCustomerFinishdetailsPageRepository(int pageIndex,int pageSize,out long rowsCount, RB_Customer_Finishdetails_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*,B.GuestNum,B.ExchangeNum,B.Income,B.ExchangeMoney
FROM RB_Customer_Finishdetails AS A LEFT JOIN rb_order AS B ON A.OrderId=B.OrderId
WHERE 1=1
");
if (query != null)
{
if (query.TaskId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Customer_Finishdetails_Extend.TaskId), query.TaskId);
}
if (query.DetailId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Customer_Finishdetails_Extend.DetailId), query.DetailId);
}
if (query.OrderId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Customer_Finishdetails_Extend.OrderId), query.OrderId);
}
if (query.CustomerId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Customer_Finishdetails_Extend.CustomerId), query.CustomerId);
}
if (query.FinishId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Customer_Finishdetails_Extend.FinishId), query.FinishId);
}
}
return GetPage(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}