protected Expression <Func <Model.plans, bool> > Where(plansCondition con) { var searchPredicate = PredicateBuilder.True <Model.plans>(); if (!string.IsNullOrEmpty(con.item_id)) { searchPredicate = searchPredicate.And(m => m.item_id.Equals(con.item_id)); } if (!string.IsNullOrEmpty(con.goodsname)) { searchPredicate = searchPredicate.And(m => m.goodsname.Contains(con.goodsname)); } if (!string.IsNullOrEmpty(con.shopname)) { searchPredicate = searchPredicate.And(m => m.shopname.Contains(con.shopname)); } if (!string.IsNullOrEmpty(con.ifok)) { searchPredicate = searchPredicate.And(m => m.ifok == con.ifok); } return(searchPredicate); }
/// <summary> /// 获取列表 /// </summary> /// <typeparam name="Tkey">类型</typeparam> /// <param name="pageIndex">页索引</param> /// <param name="pageSize">页数量</param> /// <param name="whereLambda">查询条件</param> /// <param name="orderLambda">排序条件</param> /// <param name="total">总记录数量</param> /// <returns></returns> public List <Model.plans> GetList <Tkey>(int pageIndex, int pageSize, ref int total, plansCondition con, Expression <Func <Model.plans, Tkey> > orderLambda, bool isASC = true) { Expression <Func <Model.plans, bool> > whereLambda = Where(con); return(dal.GetPagedList(pageIndex, pageSize, ref total, whereLambda, orderLambda, isASC)); }