blob: b40100b0748e9af2817976f9b5a6cfd3fb752012 [file] [log] [blame]
2230110243e9dfe2025-05-17 16:27:12 +08001package com.pt.entity;
2
3import jakarta.persistence.Entity;
4import jakarta.persistence.GeneratedValue;
5import jakarta.persistence.GenerationType;
6import jakarta.persistence.Id;
7
8import java.time.LocalDateTime;
9
10@Entity
11public class Comment {
12
13 @Id
14 @GeneratedValue(strategy = GenerationType.IDENTITY)
15 private int commentId;
16
17 private String content;
18 private String writer;
19 private int parentPost;
20
21 private LocalDateTime publishDate;
22
23 public Comment() {
24 publishDate = LocalDateTime.now();
25 }
26
27 public Comment(String content, String writer, int parentPost) {
28 this.content = content;
29 this.writer = writer;
30 this.parentPost = parentPost;
31 this.publishDate = LocalDateTime.now();
32 }
33
34 public int getCommentId() {
35 return commentId;
36 }
37
38 public void setCommentId(int commentId) {
39 this.commentId = commentId;
40 }
41
42 public String getContent() {
43 return content;
44 }
45
46 public void setContent(String content) {
47 this.content = content;
48 }
49
50 public String getWriter() {
51 return writer;
52 }
53
54 public void setWriter(String writer) {
55 this.writer = writer;
56 }
57
58 public int getParentPost() {
59 return parentPost;
60 }
61
62 public void setParentPost(int parentPost) {
63 this.parentPost = parentPost;
64 }
65
66 public LocalDateTime getPublishDate() {
67 return publishDate;
68 }
69
70 public void setPublishDate(LocalDateTime publishDate) {
71 this.publishDate = publishDate;
72 }
73}
74
75