blob: 2d8567b9b10e4cff473d46bb62458ae83eb632a9 [file] [log] [blame]
22301102b1084372025-06-01 16:44:23 +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 Resource {
12
13 @Id
14 @GeneratedValue(strategy = GenerationType.IDENTITY)
15 private int resourceId;
16
17 private String name;
18 private double size;
19
20 private LocalDateTime publishTime;
21 private String author;
22
23 private String description;
24
25 public Resource() {
26 }
27
28 public Resource(int resourceId, String name, double size, LocalDateTime publishTime, String author) {
29 this.resourceId = resourceId;
30 this.name = name;
31 this.size = size;
32 this.publishTime = publishTime;
33 this.author = author;
34 }
35
36 public int getResourceId() {
37 return resourceId;
38 }
39 public void setResourceId(int resourceId) {
40 this.resourceId = resourceId;
41 }
42 public String getName() {
43 return name;
44 }
45 public void setName(String name) {
46 this.name = name;
47 }
48 public double getSize() {
49 return size;
50 }
51 public void setSize(double size) {
52 this.size = size;
53 }
54 public LocalDateTime getPublishTime() {
55 return publishTime;
56 }
57 public void setPublishTime(LocalDateTime publishTime) {
58 this.publishTime = publishTime;
59 }
60 public String getAuthor() {
61 return author;
62 }
63 public void setAuthor(String author) {
64 this.author = author;
65 }
66 public String getDescription() {
67 return description;
68 }
69 public void setDescription(String description) {
70 this.description = description;
71 }
72
73 /*
74 * 重写toString方法,将资源信息以JSON字符串形式返回
75 */
76 @Override
77 public String toString() {
78 return "{" +
79 "\"resourceId\":" + resourceId +
80 ", \"name\":\"" + name + "\"" +
81 ", \"size\":" + size +
82 ", \"publishTime\":\"" + publishTime + "\"" +
83 ", \"author\":\"" + author + "\"" +
84 ", \"description\":\"" + description + "\"" +
85 '}';
86 }
87}