显示好友对自己发布内容 点赞 喜欢 评论信息 API 参考代码

api

/**

* 查询对我的点赞消息列表

*

* @return

*/

PageInfo queryLikeCommentListByUser(Long userId, Integer page, Integer pageSize);

/**

* 查询对我的喜欢消息列表

*

* @return

*/

PageInfo queryLoveCommentListByUser(Long userId, Integer page, Integer pageSize);

/**

* 查询对我的评论消息列表

*

* @return

*/

PageInfo queryCommentListByUser(Long userId, Integer page, Integer pageSize);




api impl

@Override

public PageInfo queryLikeCommentListByUser(Long userId, Integer page, Integer pageSize) {

return this.queryCommentListByUser(userId, CommentType.LIKE, page, pageSize);

}

@Override

public PageInfo queryLoveCommentListByUser(Long userId, Integer page, Integer pageSize) {

return this.queryCommentListByUser(userId, CommentType.LOVE, page, pageSize);

}

@Override

public PageInfo queryCommentListByUser(Long userId, Integer page, Integer pageSize) {

return this.queryCommentListByUser(userId, CommentType.COMMENT, page, pageSize);

}

private PageInfo queryCommentListByUser(Long userId, CommentType commentType, Integer page, Integer pageSize) {

PageRequest pageRequest = PageRequest.of(page - 1, pageSize,

Sort.by(Sort.Order.desc("created")));

Query query = new Query(Criteria

.where("publishUserId").is(userId)

.and("commentType").is(commentType.getType())).with(pageRequest);

List commentList = this.mongoTemplate.find(query, Comment.class);

PageInfo pageInfo = new PageInfo<>();

pageInfo.setPageNum(page);

pageInfo.setPageSize(pageSize);

pageInfo.setRecords(commentList);

return pageInfo;

}



app api vo

package com.tanhua.server.vo;

import lombok.AllArgsConstructor;

import lombok.Data;

import lombok.NoArgsConstructor;

@Data

@NoArgsConstructor

@AllArgsConstructor

public class MessageCommentVo {

private String id;

private String avatar;

private String nickname;

private String createDate; //格式:2019-09-08 10:07

}

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章