public IQueryable <Bus_Payment_Order> SearchInfoByBusPaymentOrderNumWhere(Bus_Payment_OrderSearchViewModel bus_Payment_OrderSearchViewModel) { var predicate = SearchBusPaymentOrderWhere(bus_Payment_OrderSearchViewModel); var result = DbSet.Where(predicate).OrderByDescending(o => o.AddDate); return(result); }
public IQueryable <Bus_Payment_Order> SearchInfoByBusPaymentOrderWhere(Bus_Payment_OrderSearchViewModel bus_Payment_OrderSearchViewModel) { int SkipNum = bus_Payment_OrderSearchViewModel.pageViewModel.CurrentPageNum * bus_Payment_OrderSearchViewModel.pageViewModel.PageSize; var predicate = SearchBusPaymentOrderWhere(bus_Payment_OrderSearchViewModel); var result = DbSet.Where(predicate).OrderByDescending(o => o.AddDate) .Skip(SkipNum) .Take(bus_Payment_OrderSearchViewModel.pageViewModel.PageSize); return(result); }
//根据条件查询订单 private Expression <Func <Bus_Payment_Order, bool> > SearchBusPaymentOrderWhere(Bus_Payment_OrderSearchViewModel bus_Payment_OrderSearchViewModel) { var predicate = WhereExtension.True <Bus_Payment_Order>();//初始化where表达式 if (bus_Payment_OrderSearchViewModel.Repair_InfoId != null) { predicate = predicate.And(a => a.Repair_InfoId == bus_Payment_OrderSearchViewModel.Repair_InfoId); } predicate = predicate.And(a => a.departName.Contains(bus_Payment_OrderSearchViewModel.departName)); predicate = predicate.And(a => a.isDelete.Contains(bus_Payment_OrderSearchViewModel.isDelete)); predicate = predicate.And(a => a.paymentStatus.Contains(bus_Payment_OrderSearchViewModel.paymentStatus)); predicate = predicate.And(a => a.confirmStatus.Contains(bus_Payment_OrderSearchViewModel.confirmStatus)); predicate = predicate.And(a => a.orderNo.Contains(bus_Payment_OrderSearchViewModel.OrderId)); if (bus_Payment_OrderSearchViewModel.AddDate != null) { predicate = predicate.And(a => a.AddDate.Value.Year == bus_Payment_OrderSearchViewModel.AddDate.Value.Year && a.AddDate.Value.Month == bus_Payment_OrderSearchViewModel.AddDate.Value.Month); } return(predicate); }