新版
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import com.peanut.modules.book.dao.BookForumArticlesDao;
|
||||
import com.peanut.modules.book.entity.AuthorEntity;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
@@ -24,6 +26,8 @@ import java.util.Map;
|
||||
@Service
|
||||
public class BookForumArticlesServiceImpl extends ServiceImpl<BookForumArticlesDao, BookForumArticlesEntity> implements BookForumArticlesService {
|
||||
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -57,5 +61,27 @@ public class BookForumArticlesServiceImpl extends ServiceImpl<BookForumArticlesD
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookForumArticlesEntity> getForumsLimit(Integer book_id,Integer limit) {
|
||||
LambdaQueryWrapper<BookForumArticlesEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
|
||||
wrapper.eq(BookForumArticlesEntity::getBookid,book_id);
|
||||
wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime);
|
||||
wrapper.last("limit "+limit);
|
||||
List<BookForumArticlesEntity> bookForumArticlesEntities = this.getBaseMapper().selectList(wrapper);
|
||||
//补充说话的人的用户信息
|
||||
for (BookForumArticlesEntity b : bookForumArticlesEntities){
|
||||
b.setUser(userService.getById(b.getUserid()));
|
||||
}
|
||||
return bookForumArticlesEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getForumsCount(Integer book_id) {
|
||||
LambdaQueryWrapper<BookForumArticlesEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
|
||||
wrapper.eq(BookForumArticlesEntity::getBookid,book_id);
|
||||
int count = this.count(wrapper);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import cn.com.marsoft.base.impl.BaseServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.modules.app.entity.UserEntity;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import com.peanut.modules.book.dao.BookForumCommentDao;
|
||||
import com.peanut.modules.book.entity.BookForumArticlesEntity;
|
||||
import com.peanut.modules.book.entity.BookForumCommentEntity;
|
||||
import com.peanut.modules.book.service.BookForumCommenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class BookForumCommenServiceImpl extends ServiceImpl<BookForumCommentDao, BookForumCommentEntity> implements BookForumCommenService {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
@@ -39,4 +46,43 @@ public class BookForumCommenServiceImpl extends ServiceImpl<BookForumCommentDao,
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<BookForumCommentEntity> getCommentsLimit(Integer forum_id, Integer limit) {
|
||||
LambdaQueryWrapper<BookForumCommentEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumCommentEntity::getBfaid,forum_id);
|
||||
wrapper.eq(BookForumCommentEntity::getDelflag,0);
|
||||
wrapper.orderByDesc(BookForumCommentEntity::getCreateTime);
|
||||
wrapper.last("limit "+limit);
|
||||
List<BookForumCommentEntity> bookForumCommentEntities = this.getBaseMapper().selectList(wrapper);
|
||||
|
||||
//完善人员信息
|
||||
for (BookForumCommentEntity b : bookForumCommentEntities){
|
||||
b.setUser(userService.getById(b.getUserid()));
|
||||
b.setPuser(userService.getById(b.getPuserid()));
|
||||
}
|
||||
|
||||
return bookForumCommentEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCommentcount(Integer forum_id) {
|
||||
LambdaQueryWrapper<BookForumCommentEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumCommentEntity::getBfaid,forum_id);
|
||||
wrapper.eq(BookForumCommentEntity::getDelflag,0);
|
||||
int count = this.count(wrapper);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<BookForumCommentEntity> getChildComments(Integer cid) {
|
||||
LambdaQueryWrapper<BookForumCommentEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumCommentEntity::getPid,cid);
|
||||
wrapper.eq(BookForumCommentEntity::getDelflag,0);
|
||||
wrapper.orderByAsc(BookForumCommentEntity::getCreateTime);
|
||||
List<BookForumCommentEntity> bookForumCommentEntities = this.getBaseMapper().selectList(wrapper);
|
||||
return bookForumCommentEntities;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user