feat(backend): Improve tag management and media resource access
This commit is contained in:
+13
-1
@@ -40,6 +40,18 @@ public interface CommentMapper extends BaseMapper<Comment> {
|
||||
*/
|
||||
int increaseReplyCount(@Param("commentId") Long commentId, @Param("count") int count);
|
||||
|
||||
/**
|
||||
* 更新评论状态
|
||||
*
|
||||
* @param commentId 评论ID
|
||||
* @param status 状态
|
||||
* @param updatedBy 更新人
|
||||
* @return 影响行数
|
||||
*/
|
||||
int updateCommentStatus(@Param("commentId") Long commentId,
|
||||
@Param("status") Integer status,
|
||||
@Param("updatedBy") String updatedBy);
|
||||
|
||||
/**
|
||||
* 统计视频评论数
|
||||
*
|
||||
@@ -47,4 +59,4 @@ public interface CommentMapper extends BaseMapper<Comment> {
|
||||
* @return 评论数
|
||||
*/
|
||||
int countVideoComments(@Param("videoId") Long videoId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -177,10 +177,7 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
||||
}
|
||||
|
||||
// 逻辑删除评论(设置状态为0)
|
||||
comment.setStatus(0);
|
||||
comment.setUpdatedBy(userId.toString());
|
||||
comment.setUpdateTime(LocalDateTime.now());
|
||||
updateById(comment);
|
||||
commentMapper.updateCommentStatus(id, 0, userId.toString());
|
||||
|
||||
updateVideoCommentCountAsync(comment.getVideoId(), -1);
|
||||
|
||||
@@ -449,10 +446,7 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
||||
}
|
||||
|
||||
// 逻辑删除评论(设置状态为0)
|
||||
comment.setStatus(0);
|
||||
comment.setUpdatedBy("admin");
|
||||
comment.setUpdateTime(LocalDateTime.now());
|
||||
updateById(comment);
|
||||
commentMapper.updateCommentStatus(commentId, 0, "admin");
|
||||
|
||||
updateVideoCommentCountAsync(comment.getVideoId(), -1);
|
||||
|
||||
|
||||
@@ -42,6 +42,14 @@
|
||||
WHERE id = #{commentId}
|
||||
</update>
|
||||
|
||||
<update id="updateCommentStatus">
|
||||
UPDATE comment
|
||||
SET status = #{status},
|
||||
updated_by = #{updatedBy},
|
||||
update_time = NOW()
|
||||
WHERE id = #{commentId}
|
||||
</update>
|
||||
|
||||
<!-- 统计视频评论数 -->
|
||||
<select id="countVideoComments" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
@@ -49,4 +57,4 @@
|
||||
WHERE video_id = #{videoId}
|
||||
AND status = 1
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user