This commit is contained in:
wangjinlei
2023-09-26 16:55:44 +08:00
parent e42d0243cd
commit 1755a78a8d
16 changed files with 159 additions and 146 deletions

View File

@@ -1,5 +1,4 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -7,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.app.entity.UserEntity;
import com.peanut.modules.app.service.UserService;
import com.peanut.modules.book.dao.BookForumArticlesDao;
import com.peanut.modules.book.entity.*;
@@ -180,7 +178,8 @@ public class BookForumArticlesServiceController {
wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime);
Page<BookForumArticlesEntity> bookForumArticlesEntityPage = bookForumArticlesService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
for (BookForumArticlesEntity b:bookForumArticlesEntityPage.getRecords()){
b.setUser(userService.getById(b.getUserid()));
UserEntity byId = userService.getById(b.getUserid());
b.setUser(byId);
b.setComment(bookForumCommenService.getCommentsLimit(b.getId(),3));
}
return R.ok().put("page",bookForumArticlesEntityPage);
@@ -198,26 +197,28 @@ public class BookForumArticlesServiceController {
LambdaQueryWrapper<BookForumCommentEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookForumCommentEntity::getDelflag,0);
wrapper.eq(BookForumCommentEntity::getPid,0);
wrapper.eq(BookForumCommentEntity::getBfaid,forumId);
wrapper.orderByAsc(BookForumCommentEntity::getCreateTime);
Page<BookForumCommentEntity> bookForumCommentEntityPage = bookForumCommenService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
for (BookForumCommentEntity b : bookForumCommentEntityPage.getRecords()){
b.setComments(bookForumCommenService.getChildComments(b.getId()));
b.setUser(userService.getById(b.getUserid()));
b.setPuser(userService.getById(b.getPuserid()));
b.setCommentsNum(bookForumCommenService.getCommentCountInComment(b.getId()));
}
return R.ok().put("page",bookForumCommentEntityPage);
}
/**
*
* 获取书评详情
* @param forumId
* @return
*/
@RequestMapping("/getForumdetail")
public R getForumdetail(@RequestParam Integer forumId){
return R.ok();
BookForumArticlesEntity byId = bookForumArticlesService.getById(forumId);
return R.ok().put("forum",byId);
}
/**
@@ -244,8 +245,8 @@ public class BookForumArticlesServiceController {
@RequestParam Integer forumId,
@RequestParam String content,
@RequestParam Integer userId,
@RequestParam(required = false,value = "0") Integer pid,
@RequestParam(required = false,value = "0") Integer puserId){
@RequestParam(required = false,defaultValue = "0") Integer pid,
@RequestParam(required = false,defaultValue = "0") Integer puserId){
BookForumArticlesEntity forumInfo = bookForumArticlesService.getById(forumId);
BookForumCommentEntity bookForumCommentEntity = new BookForumCommentEntity();
bookForumCommentEntity.setBfaid(forumId);
@@ -259,20 +260,6 @@ public class BookForumArticlesServiceController {
}
/**
* 添加书评项目
* @return
*/
@RequestMapping("/addForum")
public R addForum(@RequestParam Integer userId,@RequestParam String content){
return null;
}
@RequestMapping("/desc/{page}")
public R Descupd(@RequestParam Map<String, Object> params,@PathVariable("page") Integer page){
HashMap<Object, Object> map = new HashMap<>();