22301102 | aa5adbc | 2025-05-18 17:51:55 +0800 | [diff] [blame] | 1 | package com.pt.entity; |
| 2 | |
| 3 | import jakarta.persistence.Entity; |
| 4 | import jakarta.persistence.GeneratedValue; |
| 5 | import jakarta.persistence.GenerationType; |
| 6 | import jakarta.persistence.Id; |
| 7 | |
| 8 | import java.time.LocalDate; |
| 9 | |
| 10 | @Entity |
| 11 | public 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 | } |