评论新增replyCommentId字段 关联上级评论
This commit is contained in:
parent
9a96b016cc
commit
15b28fe6b5
@ -197,6 +197,7 @@ public class DynamicCommentCmdExe {
|
||||
if (Objects.nonNull(cmd.getToUserId())) {
|
||||
comment.setRootCommentId(cmd.getRootCommentId());
|
||||
}
|
||||
comment.setReplyCommentId(cmd.getCommentId());
|
||||
dynamicCommentService.save(comment);
|
||||
|
||||
return comment;
|
||||
|
||||
@ -68,6 +68,7 @@ public class DynamicCommentDelCmdExe {
|
||||
updateScore(cmd, comment);
|
||||
|
||||
dynamicCommentService.deleteByRootCommentId(cmd.getId());
|
||||
dynamicCommentService.deleteByReplyCommentId(cmd.getId());
|
||||
dynamicCommentLikeService.deleteByRootCommentId(cmd.getId());
|
||||
|
||||
Integer dynamicCommentCount = dynamicCommentService
|
||||
@ -95,12 +96,12 @@ public class DynamicCommentDelCmdExe {
|
||||
private Long deleteComment(AppIdLongCmd cmd, DynamicComment comment) {
|
||||
|
||||
dynamicCommentService.deleteById(cmd.getId());
|
||||
dynamicCommentService.deleteByReplyCommentId(cmd.getId());
|
||||
|
||||
dynamicPopularService.updateScore(comment.getDynamicContentId(),
|
||||
-(getCommentLikeQuantity(comment).intValue() * dynamicCacheService.getLikeScore()),
|
||||
cmd.getReqSysOrigin().getOrigin(), null);
|
||||
Integer dynamicCommentCount = dynamicCommentService
|
||||
.getNumberByDynamicId(comment.getDynamicContentId());
|
||||
|
||||
return dynamicCacheService.updateCommentQuantity(comment.getDynamicContentId(), -1);
|
||||
return dynamicCacheService.initCommentQuantity(comment.getDynamicContentId(), dynamicCommentCount).longValue();
|
||||
}
|
||||
|
||||
private Long getCommentLikeQuantity(DynamicComment comment) {
|
||||
|
||||
@ -56,6 +56,7 @@ public class DynamicChildCommentQryExe {
|
||||
listCO.setUserSex(createUser.getUserSex());
|
||||
listCO.setUserId(createUser.getId());
|
||||
listCO.setRootCommentId(comment.getRootCommentId());
|
||||
listCO.setReplyCommentId(comment.getReplyCommentId());
|
||||
|
||||
UserProfile toUser = userMap.get(comment.getToUserId());
|
||||
if (Objects.nonNull(toUser)) {
|
||||
|
||||
@ -73,6 +73,7 @@ public class DynamicCommentQryExe {
|
||||
listCO.setUserSex(createUser.getUserSex());
|
||||
listCO.setUserId(createUser.getId());
|
||||
listCO.setRootCommentId(comment.getRootCommentId());
|
||||
listCO.setReplyCommentId(comment.getReplyCommentId());
|
||||
|
||||
UserProfile toUser = userMap.get(comment.getToUserId());
|
||||
if (Objects.nonNull(toUser)) {
|
||||
|
||||
@ -94,6 +94,12 @@ public class DynamicCommentListCO extends ClientObject {
|
||||
*/
|
||||
private Long rootCommentId;
|
||||
|
||||
|
||||
/**
|
||||
* 回复评论ID
|
||||
*/
|
||||
private Long replyCommentId;
|
||||
|
||||
/**
|
||||
* 子评论数量(仅根评论有值)
|
||||
*/
|
||||
|
||||
@ -39,6 +39,11 @@ public class DynamicCommentCmd extends AppExtCommand {
|
||||
*/
|
||||
private Long toUserId;
|
||||
|
||||
/**
|
||||
* 评论ID
|
||||
*/
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 根评论ID
|
||||
*/
|
||||
|
||||
@ -54,6 +54,12 @@ public class DynamicComment extends TimestampBaseEntity {
|
||||
@TableField("root_comment_id")
|
||||
private Long rootCommentId;
|
||||
|
||||
/**
|
||||
* 回复评论ID
|
||||
*/
|
||||
@TableField("reply_comment_id")
|
||||
private Long replyCommentId;
|
||||
|
||||
/**
|
||||
* 热度分数
|
||||
*/
|
||||
|
||||
@ -85,6 +85,12 @@ public interface DynamicCommentService extends BaseService<DynamicComment> {
|
||||
*/
|
||||
void deleteByRootCommentId(Long rootCommentId);
|
||||
|
||||
/**
|
||||
* 根据回复评论id删除
|
||||
*
|
||||
*/
|
||||
void deleteByReplyCommentId(Long rootCommentId);
|
||||
|
||||
/**
|
||||
* 根据评论id删除评论
|
||||
*
|
||||
|
||||
@ -149,6 +149,14 @@ public class DynamicCommentServiceImpl extends
|
||||
delete().eq(DynamicComment::getId, rootCommentId).last(PageConstant.LIMIT_ONE).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByReplyCommentId(Long replyCommentId) {
|
||||
if (Objects.isNull(replyCommentId)) {
|
||||
return;
|
||||
}
|
||||
delete().eq(DynamicComment::getReplyCommentId, replyCommentId).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
if (Objects.isNull(id)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user