海外读书修改
This commit is contained in:
@@ -40,7 +40,7 @@ public class BookAbroadController {
|
||||
|
||||
//评论树
|
||||
@RequestMapping("/getBookAbroadCommentTree")
|
||||
public List<BookAbroadComment> getBookAbroadCommentTree(@RequestBody Map<String,Object> params) {
|
||||
public R getBookAbroadCommentTree(@RequestBody Map<String,Object> params) {
|
||||
List<BookAbroadComment> comments = bookAbroadCommentService.list(new LambdaQueryWrapper<BookAbroadComment>()
|
||||
.eq(BookAbroadComment::getBookId,params.get("bookId")));
|
||||
List<BookAbroadComment> commentsTree = comments.stream().filter((bookAbroadComment) ->
|
||||
@@ -49,13 +49,15 @@ public class BookAbroadController {
|
||||
comment.setIsLike(bookAbroadCommentLikeService.count(new LambdaQueryWrapper<BookAbroadCommentLike>()
|
||||
.eq(BookAbroadCommentLike::getCommentId,comment.getId())
|
||||
.eq(BookAbroadCommentLike::getUserId,ShiroUtils.getUId())));
|
||||
comment.setLikeCount(bookAbroadCommentLikeService.count(new LambdaQueryWrapper<BookAbroadCommentLike>()
|
||||
.eq(BookAbroadCommentLike::getCommentId,comment.getId())));
|
||||
comment.setUserEntity(userService.getOne(new LambdaQueryWrapper<MyUserEntity>()
|
||||
.select(MyUserEntity::getId,MyUserEntity::getName,MyUserEntity::getNickname,MyUserEntity::getAvatar)
|
||||
.eq(MyUserEntity::getId,comment.getUserId())));
|
||||
comment.setChildren(getLabelChildrens(comment,comments));
|
||||
return comment;
|
||||
}).collect(Collectors.toList());
|
||||
return commentsTree;
|
||||
return R.ok().put("commentsTree",commentsTree);
|
||||
}
|
||||
|
||||
private List<BookAbroadComment> getLabelChildrens(BookAbroadComment root,List<BookAbroadComment> all){
|
||||
|
||||
@@ -171,6 +171,16 @@ public class HomeController {
|
||||
return R.ok().put("contentPage",contentPage);
|
||||
}
|
||||
|
||||
//已读\已买人数
|
||||
@RequestMapping("/getBookReadCount")
|
||||
public R getBookReadCount(@RequestBody Map<String,Object> params){
|
||||
int readCount = bookReadRateService.count(new LambdaQueryWrapper<BookReadRateEntity>()
|
||||
.eq(BookReadRateEntity::getBookId,params.get("bookId")));
|
||||
int buyCount = userEbookBuyService.count(new LambdaQueryWrapper<UserEbookBuyEntity>()
|
||||
.eq(UserEbookBuyEntity::getBookId,params.get("bookId")));
|
||||
return R.ok().put("readCount",readCount).put("buyCount",buyCount);
|
||||
}
|
||||
|
||||
//获取当前书的阅读记录
|
||||
@RequestMapping("/getBookReadRate")
|
||||
public R getBookReadRate(@RequestBody Map<String,Object> params){
|
||||
|
||||
@@ -33,6 +33,8 @@ public class BookAbroadComment implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private int isLike;
|
||||
@TableField(exist = false)
|
||||
private int likeCount;
|
||||
@TableField(exist = false)
|
||||
private MyUserEntity userEntity;
|
||||
@TableField(exist = false)
|
||||
private List<BookAbroadComment> children;
|
||||
|
||||
Reference in New Issue
Block a user