userentity bug

This commit is contained in:
wangjinlei
2023-10-18 12:41:22 +08:00
parent 59f46eb2aa
commit 8f7f785ba9
21 changed files with 75 additions and 239 deletions

View File

@@ -6,28 +6,20 @@ 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;
import com.peanut.modules.book.entity.BookForumArticlesEntity;
import com.peanut.modules.book.entity.PublisherEntity;
import com.peanut.modules.book.service.AuthorService;
import com.peanut.modules.book.service.BookForumArticlesService;
import com.peanut.modules.book.service.BookService;
import com.peanut.modules.book.service.PublisherService;
import com.peanut.modules.book.service.MyUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
public class BookForumArticlesServiceImpl extends ServiceImpl<BookForumArticlesDao, BookForumArticlesEntity> implements BookForumArticlesService {
@Autowired
UserService userService;
@Override
@@ -61,20 +53,6 @@ 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) {

View File

@@ -6,10 +6,10 @@ 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.BookForumCommentDao;
import com.peanut.modules.book.entity.BookForumCommentEntity;
import com.peanut.modules.book.service.BookForumCommenService;
import com.peanut.modules.book.service.MyUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -20,7 +20,7 @@ import java.util.Map;
public class BookForumCommenServiceImpl extends ServiceImpl<BookForumCommentDao, BookForumCommentEntity> implements BookForumCommenService {
@Autowired
private UserService userService;
private MyUserService userService;
@Override
public PageUtils queryPage(Map<String, Object> params) {

View File

@@ -8,6 +8,7 @@ import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
import com.aliyun.tea.TeaException;
import com.aliyun.teautil.Common;
import com.aliyun.teautil.models.RuntimeOptions;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.google.common.collect.Maps;
import com.peanut.common.utils.*;
@@ -55,6 +56,8 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
private CouponHistoryService couponHistoryService;
@Autowired
private MyUserDao myUserDao;
@Autowired
private BookForumArticlesService bookForumArticlesService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
@@ -145,6 +148,21 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
return true;
}
@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 = bookForumArticlesService.getBaseMapper().selectList(wrapper);
//补充说话的人的用户信息
for (BookForumArticlesEntity b : bookForumArticlesEntities){
b.setUser(this.getById(b.getUserid()));
}
return bookForumArticlesEntities;
}