💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
pageSize:每页的记录数大小 pageNumber:当前页码 allCount:总记录数 ~~~ UserTab user = new UserTab(); OQL qLIST = OQL.From(user).Select().Where(cmpFun).OrderBy(user.UserName, "asc").END; qLIST.Limit(pageSize, pageNumber); qLIST.PageWithAllRecordCount = allCount; EntityQuery<UserTab >.QueryList(qLIST); ~~~ 分页泛型方法 ~~~ #region 分页 /// <summary> /// 分页查询实体列表 /// </summary> /// <param name="pageSize">每页数据</param> /// <param name="curPage">当前页</param> /// <param name="recordCount">总记录数</param> /// <param name="cmpFunc">条件</param> /// <param name="orderBy">排序</param> /// <param name="act">查询后的实体填充方法</param> /// <returns></returns> public static List<T> GetList(int pageSize, int curPage, ref int recordCount, OQLCompareFunc<T> cmpFunc, OQLOrderAction<T> orderBy, Action<T> act = null) { T entity = new T(); OQL q = OQL.From(entity).Select().Where<T>(cmpFunc).OrderBy(orderBy).END; q.Limit(pageSize, curPage); q.PageWithAllRecordCount = recordCount; var lst = EntityQuery<T>.QueryList(q); //第一次查询时得到真实页数 if (recordCount == 0) { recordCount = q.PageWithAllRecordCount; } if (lst.Count > 0 && null != act) { lst.ForEach(d => act(d)); } return lst; } #endregion 分页 ~~~