//根据条件查询订单 private Expression <Func <Bus_Payment_Order, bool> > SearchBusPaymentWhere(Bus_OrderIsPassSearchViewModel bus_OrderIsPassSearchViewModel) { var predicate = WhereExtension.True <Bus_Payment_Order>();//初始化where表达式 if (bus_OrderIsPassSearchViewModel.User_InfoId != null) { predicate = predicate.And(a => a.createUser == bus_OrderIsPassSearchViewModel.User_InfoId); } predicate = predicate.And(a => a.paymentStatus != "0"); // predicate = predicate.And(a => a.Repair_Info.isEnd== bus_OrderIsPassSearchViewModel.isPass); predicate = predicate.And(a => a.isDelete == "0"); return(predicate); }
public List <Bus_Payment_Order> SearchInfoByUserIdWhere(Bus_OrderIsPassSearchViewModel bus_OrderIsPassSearchViewModel) { int SkipNum = bus_OrderIsPassSearchViewModel.pageViewModel.CurrentPageNum * bus_OrderIsPassSearchViewModel.pageViewModel.PageSize; var predicate = SearchBusPaymentWhere(bus_OrderIsPassSearchViewModel); var result = DbSet.Where(predicate) .OrderByDescending(o => o.AddDate) .Skip(SkipNum) .Take(bus_OrderIsPassSearchViewModel.pageViewModel.PageSize) .ToList(); return(result); }