blob: af6e91f60e5f5749ff4547acdc433b620025c73b [file] [log] [blame]
package com.example.myproject.entity;
import javax.persistence.Entity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "seed_comments") // 映射到数据库表 seed_comments
public class SeedComment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) // 自增主键
@Column(name = "comment_id") // 映射到表的 comment_id 列
private long commentId;
@Column(name = "seed_id", nullable = false)
private long seedId;
@Column(name = "com_comment_id", nullable = true)
private long comCommentId; // 外键,指向父评论的 comment_id
@Column(name = "user_id",nullable = false)
private long userId;
@Column(name = "content", nullable = false)
private String content;
@Column(name = "is_anonymous")
private byte isAnonymous;
@Column(name = "likes_count", nullable = false)
private int likesCount;
@Column(name = "reply_count", nullable = false)
private int replyCount;
@Column(name = "comment_time")
private Date commentTime;
// Getter 和 Setter 方法
public long getCommentId() {
return commentId;
}
public void setCommentId(long commentId) {
this.commentId = commentId;
}
public long getSeedId() {
return seedId;
}
public void setSeedId(long seedId) {
this.seedId = seedId;
}
public long getComCommentId() {
return comCommentId;
}
public void setComCommentId(long comCommentId) {
this.comCommentId = comCommentId;
}
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 byte getIsAnonymous() {
return isAnonymous;
}
public void setIsAnonymous(byte isAnonymous) {
this.isAnonymous = isAnonymous;
}
public int getLikesCount() {
return likesCount;
}
public void setLikesCount(int likesCount) {
this.likesCount = likesCount;
}
public int getReplyCount() {
return replyCount;
}
public void setReplyCount(int replyCount) {
this.replyCount = replyCount;
}
public Date getCommentTime() {
return commentTime;
}
public void setCommentTime(Date commentTime) {
this.commentTime = commentTime;
}
}