/// <summary> /// 分页查询 /// </summary> /// <param name="queryPager_Book_User"></param> /// <returns></returns> public Models.Response.PageResult GetByPage(QueryPager_Book_Chapter_Read_Record queryPager_Book_User, string Book_Name, string Author) { //查询表达式 var exp = Cat.M.Book.Services.Helper.ExpressionHelper.GetExpressionByQueryPager <QueryPager_Book_Chapter_Read_Record, Book_Chapter_Read_Record>(queryPager_Book_User); //排序 Dictionary <string, string> dicOrderBy = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(queryPager_Book_User.sorter)) { dicOrderBy.Add(queryPager_Book_User.sort, queryPager_Book_User.order); } else { dicOrderBy.Add("Create_Time", "desc"); } var q = from a in base.Entities.Where(exp) join t in AllServices.BookReadRecordService.Entities on a.Book_Read_Record_Id equals t.Id into temp from tt in temp.DefaultIfEmpty() select new Book_Chapter_Read_Record() { Id = a.Id, Book_Read_Record_Id = a.Book_Read_Record_Id, Openid = a.Openid, Chapter_Name = a.Chapter_Name, Chapter_Link = a.Chapter_Link, Number_Of_Words = a.Number_Of_Words, Duration = a.Duration, Book_Name = tt.Book_Name, Book_Link = tt.Book_Link, Author = tt.Author, Create_Time = a.Create_Time, Update_Time = a.Update_Time }; if (!string.IsNullOrEmpty(Book_Name)) { q = q.Where(w => w.Book_Name.Contains(Book_Name)); } if (!string.IsNullOrEmpty(Author)) { q = q.Where(w => w.Author.Contains(Author)); } int count = q.Count(); var list = q.OrderBy(dicOrderBy).Skip((queryPager_Book_User.pn - 1) * queryPager_Book_User.ps).Take(queryPager_Book_User.ps).ToList(); return(new Models.Response.PageResult() { Count = count, List = list, Pageindex = queryPager_Book_User.pn, Pagesize = queryPager_Book_User.ps, Pages = (count / queryPager_Book_User.ps) + (count % queryPager_Book_User.ps > 0 ? 1 : 0) }); //return base.GetByPage(queryPager_Book_User.pn, queryPager_Book_User.ps, exp, listOrderBy); }
/// <summary> /// 获取小说章节阅读记录 /// </summary> /// <param name="requestParams"></param> /// <returns></returns> public ActionRes GetListByPage(QueryPager_Book_Chapter_Read_Record requestParams, string Book_Name, string Author) { var pageResult = AllServices.BookChapterReadRecordService.GetByPage(requestParams, Book_Name, Author); return(ActionRes.Success(pageResult)); }