blob: ef36c5c25973c6533410e38786f81174533ac09c [file] [log] [blame]
22301102aa5adbc2025-05-18 17:51:55 +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.LocalDate;
9
10@Entity
11public class Post {
12
13 @Id
14 @GeneratedValue(strategy = GenerationType.IDENTITY)
15 private int pid;
16
17 private String title;
18 private String content;
19 private String author;
20 private LocalDate publishDate;
21
22 public Post() {
23 }
24
25 public Post(String title, String content, String author) {
26 this.title = title;
27 this.content = content;
28 this.author = author;
29 this.publishDate = LocalDate.now();
30 }
31
32 public int getPid() {
33 return pid;
34 }
35
36 public void setPid(int pid) {
37 this.pid = pid;
38 }
39
40 public String getTitle() {
41 return title;
42 }
43
44 public void setTitle(String title) {
45 this.title = title;
46 }
47
48 public String getContent() {
49 return content;
50 }
51
52 public void setContent(String content) {
53 this.content = content;
54 }
55
56 public String getAuthor() {
57 return author;
58 }
59
60 public void setAuthor(String author) {
61 this.author = author;
62 }
63
64 public LocalDate getPublishDate() {
65 return publishDate;
66 }
67
68 public void setPublishDate(LocalDate publishDate) {
69 this.publishDate = publishDate;
70 }
71}