blob: af6e91f60e5f5749ff4547acdc433b620025c73b [file] [log] [blame]
223011381c359102025-06-03 15:19:59 +08001package com.example.myproject.entity;
2
3import javax.persistence.Entity;
4import javax.persistence.*;
5
6
7import java.util.Date;
8
9@Entity
10@Table(name = "seed_comments") // 映射到数据库表 seed_comments
11public class SeedComment {
12
13 @Id
14 @GeneratedValue(strategy = GenerationType.IDENTITY) // 自增主键
15 @Column(name = "comment_id") // 映射到表的 comment_id 列
16 private long commentId;
17
18
19 @Column(name = "seed_id", nullable = false)
20 private long seedId;
21
22
23 @Column(name = "com_comment_id", nullable = true)
24 private long comCommentId; // 外键,指向父评论的 comment_id
25
26
27 @Column(name = "user_id",nullable = false)
28 private long userId;
29
30 @Column(name = "content", nullable = false)
31 private String content;
32
33 @Column(name = "is_anonymous")
34 private byte isAnonymous;
35
36 @Column(name = "likes_count", nullable = false)
37 private int likesCount;
38
39 @Column(name = "reply_count", nullable = false)
40 private int replyCount;
41
42 @Column(name = "comment_time")
43 private Date commentTime;
44
45 // Getter 和 Setter 方法
46
47 public long getCommentId() {
48 return commentId;
49 }
50
51 public void setCommentId(long commentId) {
52 this.commentId = commentId;
53 }
54
55 public long getSeedId() {
56 return seedId;
57 }
58
59 public void setSeedId(long seedId) {
60 this.seedId = seedId;
61 }
62
63 public long getComCommentId() {
64 return comCommentId;
65 }
66
67 public void setComCommentId(long comCommentId) {
68 this.comCommentId = comCommentId;
69 }
70
71 public long getUserId() {
72 return userId;
73 }
74
75 public void setUserId(long userId) {
76 this.userId = userId;
77 }
78
79 public String getContent() {
80 return content;
81 }
82
83 public void setContent(String content) {
84 this.content = content;
85 }
86
87 public byte getIsAnonymous() {
88 return isAnonymous;
89 }
90
91 public void setIsAnonymous(byte isAnonymous) {
92 this.isAnonymous = isAnonymous;
93 }
94
95 public int getLikesCount() {
96 return likesCount;
97 }
98
99 public void setLikesCount(int likesCount) {
100 this.likesCount = likesCount;
101 }
102
103 public int getReplyCount() {
104 return replyCount;
105 }
106
107 public void setReplyCount(int replyCount) {
108 this.replyCount = replyCount;
109 }
110
111 public Date getCommentTime() {
112 return commentTime;
113 }
114
115 public void setCommentTime(Date commentTime) {
116 this.commentTime = commentTime;
117 }
118}