public bool ListByUserId(int userid, ref SqlSugar.PageModel page, ref List <TASM_TRAVEL> list) { int pagecount = 0; list = Db.Queryable <TASM_TRAVEL>().Where(s => s.USERID == userid) .OrderBy(s => s.CREATETIME, OrderByType.Desc) .ToPageList(page.PageIndex, page.PageSize, ref pagecount); page.PageCount = pagecount; return(list.Count > 0); }
public List <T> GetPageList <T>(Expression <Func <T, bool> > whereExpression, PageModel page, Expression <Func <T, object> > orderByExpression = null, OrderByType orderByType = OrderByType.Asc) where T : class, new() { int count = 0; var result = Context.Queryable <T>().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(whereExpression).ToPageList(page.PageIndex, page.PageSize, ref count); page.PageCount = count; return(result); }
public List <T> GetPageList <T>(Expression <Func <T, bool> > whereExpression, PageModel page) where T : class, new() { int count = 0; var result = Context.Queryable <T>().Where(whereExpression).ToPageList(page.PageIndex, page.PageSize, ref count); page.PageCount = count; return(result); }
/// <summary> /// 根据表达式查询分页并排序 /// </summary> /// <param name="whereExpression">it</param> /// <param name="pageModel"></param> /// <param name="orderByExpression">it=>it.id或者it=>new{it.id,it.name}</param> /// <param name="orderByType">OrderByType.Desc</param> /// <returns></returns> public virtual List <T> GetPageList(Expression <Func <T, bool> > whereExpression, PageModel pageModel, Expression <Func <T, object> > orderByExpression = null, OrderByType orderByType = OrderByType.Asc) { return(CurrentDb.GetPageList(whereExpression, pageModel, orderByExpression, orderByType)); }
/// <summary> /// 根据表达式查询分页 /// </summary> /// <returns></returns> public virtual List <T> GetPageList(Expression <Func <T, bool> > whereExpression, PageModel pageModel) { return(CurrentDb.GetPageList(whereExpression, pageModel)); }
public virtual async Task <List <T> > GetPageListAsync(List <IConditionalModel> conditionalList, PageModel page, Expression <Func <T, object> > orderByExpression = null, OrderByType orderByType = OrderByType.Asc) { RefAsync <int> count = 0; var result = await Context.Queryable <T>().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(conditionalList).ToPageListAsync(page.PageIndex, page.PageSize, count); page.TotalCount = count; return(result); }
public virtual async Task <List <T> > GetPageListAsync(List <IConditionalModel> conditionalList, PageModel page) { RefAsync <int> count = 0; var result = await Context.Queryable <T>().Where(conditionalList).ToPageListAsync(page.PageIndex, page.PageSize, count); page.TotalCount = count; return(result); }
public virtual async Task <List <T> > GetPageListAsync(Expression <Func <T, bool> > whereExpression, PageModel page) { RefAsync <int> count = 0; var result = await Context.Queryable <T>().Where(whereExpression).ToPageListAsync(page.PageIndex, page.PageSize, count); page.TotalCount = count; return(result); }
public virtual List <T> GetPageList(List <IConditionalModel> conditionalList, PageModel page) { int count = 0; var result = Context.Queryable <T>().Where(conditionalList).ToPageList(page.PageIndex, page.PageSize, ref count); page.TotalCount = count; return(result); }
/// <summary> /// 分页查询 /// </summary> /// <param name="whereExpression">条件筛选</param> /// <param name="pageModel">分页数据</param> /// <param name="pageCount">筛选后的总页数</param> /// <param name="orderByExpression">排序字段 it=>it.id或者it=>new{it.id,it.name}</param> /// <param name="orderByType">排序分类 默认OrderByType.Asc</param> /// <returns></returns> public virtual List <T> GetPageList(Expression <Func <T, bool> > whereExpression, PageModel pageModel, ref int total, Expression <Func <T, object> > orderByExpression = null, OrderByType orderByType = OrderByType.Asc) { var list = Db.Queryable <T>() .Where(whereExpression.ExpressionAnd(x => x.IsDeleted == false)) .OrderBy(orderByExpression, orderByType).ToPageList(pageModel.PageIndex, pageModel.PageSize, ref total); return(list); }
/// <summary> /// 根据表达式查询分页 /// </summary> /// <returns></returns> public virtual List <T> GetPageList(Expression <Func <T, bool> > whereExpression, PageModel pageModel) { return(CurrentDb.GetPageList(whereExpression.ExpressionAnd(x => x.IsDeleted == false), pageModel)); }
public virtual List <T> GetPageList(List <IConditionalModel> conditionalList, PageModel page, Expression <Func <T, object> > orderByExpression = null, OrderByType orderByType = OrderByType.Asc) { int count = 0; var result = Context.Queryable <T>().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(conditionalList).ToPageList(page.PageIndex, page.PageSize, ref count); page.PageCount = count; return(result); }