夜雨声烦 | 5c9d131 | 2025-04-23 17:46:19 +0800 | [diff] [blame] | 1 | package com.example.g8backend.entity; |
| 2 | |
| 3 | import java.sql.Timestamp; |
| 4 | import java.util.List; |
| 5 | |
| 6 | public class Comment { |
| 7 | private Long commentId; // 评论ID |
| 8 | private Long postId; // 所属帖子ID |
| 9 | private Long userId; // 评论用户ID |
| 10 | private String content; // 评论内容 |
| 11 | private Long parentCommentId; // 父评论ID,如果是顶级评论则为NULL |
| 12 | private Timestamp createdAt; // 评论时间 |
| 13 | |
| 14 | private List<Comment> replies; |
| 15 | |
| 16 | // Getter and Setter |
| 17 | public Long getCommentId() { |
| 18 | return commentId; |
| 19 | } |
| 20 | |
| 21 | public void setCommentId(Long commentId) { |
| 22 | this.commentId = commentId; |
| 23 | } |
| 24 | |
| 25 | public Long getPostId() { |
| 26 | return postId; |
| 27 | } |
| 28 | |
| 29 | public void setPostId(Long postId) { |
| 30 | this.postId = postId; |
| 31 | } |
| 32 | |
| 33 | public Long getUserId() { |
| 34 | return userId; |
| 35 | } |
| 36 | |
| 37 | public void setUserId(Long userId) { |
| 38 | this.userId = userId; |
| 39 | } |
| 40 | |
| 41 | public String getContent() { |
| 42 | return content; |
| 43 | } |
| 44 | |
| 45 | public void setContent(String content) { |
| 46 | this.content = content; |
| 47 | } |
| 48 | |
| 49 | public Long getParentCommentId() { |
| 50 | return parentCommentId; |
| 51 | } |
| 52 | |
| 53 | public void setParentCommentId(Long parentCommentId) { |
| 54 | this.parentCommentId = parentCommentId; |
| 55 | } |
| 56 | |
| 57 | public Timestamp getCreatedAt() { |
| 58 | return createdAt; |
| 59 | } |
| 60 | |
| 61 | public void setCreatedAt(Timestamp createdAt) { |
| 62 | this.createdAt = createdAt; |
| 63 | } |
| 64 | |
| 65 | // Getter and Setter for replies |
| 66 | public List<Comment> getReplies() { |
| 67 | return replies; |
| 68 | } |
| 69 | |
| 70 | public void setReplies(List<Comment> replies) { |
| 71 | this.replies = replies; |
| 72 | } |
| 73 | } |