public ExeResEdm GetListByPage(string tableName, PageSerach <T> para, DBOperUser dbLogMsg = null) { var orderByStr = LambdaToSqlHelper <T> .GetSqlFromLambda(para.OrderBy).OrderbySql; string whereSql = !string.IsNullOrEmpty(para.StrWhere) ? para.StrWhere : LambdaToSqlHelper <T> .GetWhereFromLambda(para.Filter, DBStoreType.NoSelect); SearchParam searchParam = new SearchParam() { Orderby = orderByStr, PageIndex = para.PageIndex, PageSize = para.PageSize, TableName = tableName, StrWhere = whereSql, }; ExeResEdm res = GetDTByPage(searchParam); int curNum = 0; if (res.ErrCode == 0) { List <T> list = DtModelConvert <T> .DatatableToList((res.ExeModel as DataTable)); res.ExeModel = list.AsQueryable(); curNum = list.Count(); res.ExeNum = searchParam.TotalCount; } WriteLogMsg(dbLogMsg, LogType.查询, "根据[" + DtModelConvert <T> .SerializeToString(searchParam) + "]获取了分页数据,返回了" + curNum + "/" + searchParam.TotalCount + "条记录", tableName); return(res); }
public ExeResEdm GetListByPage(string tableName, PageSerach <T> para) { var orderByStr = LambdaToSqlHelper <T> .GetSqlFromLambda(para.OrderBy).OrderbySql; string whereSql = !string.IsNullOrEmpty(para.StrWhere) ? para.StrWhere : LambdaToSqlHelper <T> .GetWhereFromLambda(para.Filter, DataBaseType.NoSelect); SearchParam searchParam = new SearchParam() { Orderby = orderByStr, PageIndex = para.PageIndex, PageSize = para.PageSize, TableName = tableName, StrWhere = whereSql, }; ExeResEdm res = GetDTByPage(searchParam); para.StrWhere = whereSql; if (res.ErrCode == 0) { List <T> list = DtModelConvert <T> .DatatableToList((res.ExeModel as DataTable)); res.ExeModel = list.AsQueryable(); return(res); } else { return(res); } }