comment
Change-Id: Iafdf1c3e19b18faa75e96fde1acad93fda6f77f0
diff --git a/src/main/java/com/example/g8backend/entity/Comment.java b/src/main/java/com/example/g8backend/entity/Comment.java
new file mode 100644
index 0000000..30fa763
--- /dev/null
+++ b/src/main/java/com/example/g8backend/entity/Comment.java
@@ -0,0 +1,73 @@
+package com.example.g8backend.entity;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+public class Comment {
+ private Long commentId; // 评论ID
+ private Long postId; // 所属帖子ID
+ private Long userId; // 评论用户ID
+ private String content; // 评论内容
+ private Long parentCommentId; // 父评论ID,如果是顶级评论则为NULL
+ private Timestamp createdAt; // 评论时间
+
+ private List<Comment> replies;
+
+ // Getter and Setter
+ public Long getCommentId() {
+ return commentId;
+ }
+
+ public void setCommentId(Long commentId) {
+ this.commentId = commentId;
+ }
+
+ public Long getPostId() {
+ return postId;
+ }
+
+ public void setPostId(Long postId) {
+ this.postId = postId;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public Long getParentCommentId() {
+ return parentCommentId;
+ }
+
+ public void setParentCommentId(Long parentCommentId) {
+ this.parentCommentId = parentCommentId;
+ }
+
+ public Timestamp getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(Timestamp createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ // Getter and Setter for replies
+ public List<Comment> getReplies() {
+ return replies;
+ }
+
+ public void setReplies(List<Comment> replies) {
+ this.replies = replies;
+ }
+}