Commit c95a12cc authored by 刘基明's avatar 刘基明

我的评论修复

parent 6a387d8d
...@@ -437,7 +437,7 @@ public class ThemeManager { ...@@ -437,7 +437,7 @@ public class ThemeManager {
List<ThemeQo> commentThemeList = new ArrayList<>(); List<ThemeQo> commentThemeList = new ArrayList<>();
List<ThemeEntity> themeEntities; List<ThemeEntity> themeEntities;
//评论列表 //评论列表
List<CommentEntity> commentEntities = commentService.queryThemesByUserId(req.getUserId(), req.getLastId(), req.getPageSize()); List<CommentEntity> commentEntities = commentService.queryCommentsByUserId(req.getUserId(), req.getLastId(), req.getPageSize());
//当前用户信息 //当前用户信息
UserInfoNew userInfo = redisCache.getObject(StringUtils.joinWith(CACHE_FEIGN_USER_INFO, req.getUserId()), UserInfoNew userInfo = redisCache.getObject(StringUtils.joinWith(CACHE_FEIGN_USER_INFO, req.getUserId()),
60 * 10, () ->this.getUserInfo(req.getUserId()) , UserInfoNew.class); 60 * 10, () ->this.getUserInfo(req.getUserId()) , UserInfoNew.class);
......
...@@ -85,7 +85,7 @@ public class CommentService { ...@@ -85,7 +85,7 @@ public class CommentService {
} }
public List<CommentEntity> queryThemesByUserId(String userId) { public List<CommentEntity> queryCommentsByUserId(String userId) {
return commentMapper.selectList(new LambdaQueryWrapper<CommentEntity>() return commentMapper.selectList(new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getAuthorId,userId) .eq(CommentEntity::getAuthorId,userId)
.eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode()) .eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode())
...@@ -93,15 +93,16 @@ public class CommentService { ...@@ -93,15 +93,16 @@ public class CommentService {
} }
public List<CommentEntity> queryThemesByUserId(String userId, String lastId,Integer pageSize) { public List<CommentEntity> queryCommentsByUserId(String userId, String lastId, Integer pageSize) {
LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>() LambdaQueryWrapper<CommentEntity> queryWrapper = new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getAuthorId, userId) .eq(CommentEntity::getAuthorId, userId)
.eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode()) .eq(CommentEntity::getCommentType, CommentTypeEnum.THEME.getCode())
.eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()); .eq(CommentEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())
.orderByDesc(CommentEntity::getCreateTime);
if (StringUtils.isNotEmpty(lastId)) { if (StringUtils.isNotEmpty(lastId)) {
CommentEntity commentEntity = commentMapper.selectOne(new LambdaQueryWrapper<CommentEntity>() CommentEntity commentEntity = commentMapper.selectOne(new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getCommentId,lastId)); .eq(CommentEntity::getCommentId,lastId));
if (commentEntity==null) throw new BizException("主题未找到,id:"+lastId); if (commentEntity==null) throw new BizException("评论未找到,id:"+lastId);
queryWrapper.lt(CommentEntity::getUpdateTime, commentEntity.getCreateTime()); queryWrapper.lt(CommentEntity::getUpdateTime, commentEntity.getCreateTime());
} }
if (pageSize!=null){ if (pageSize!=null){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment