完成部分资源功能
Change-Id: Idfaef80363ef191a294e52ae53cdd4e2b3e7ccef
diff --git a/src/main/java/com/pt/entity/Download.java b/src/main/java/com/pt/entity/Download.java
index 1ae9354..38b955a 100644
--- a/src/main/java/com/pt/entity/Download.java
+++ b/src/main/java/com/pt/entity/Download.java
@@ -14,14 +14,14 @@
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int downloadId;
- private int resourceId;
+ private String resourceId;
private String downloader;
private LocalDateTime downloadTime;
public Download() {
}
- public Download(int downloadId, int resourceId, String downloader, LocalDateTime downloadTime) {
+ public Download(int downloadId, String resourceId, String downloader, LocalDateTime downloadTime) {
this.downloadId = downloadId;
this.resourceId = resourceId;
this.downloader = downloader;
@@ -34,10 +34,10 @@
public void setDownloadId(int downloadId) {
this.downloadId = downloadId;
}
- public int getResourceId() {
+ public String getResourceId() {
return resourceId;
}
- public void setResourceId(int resourceId) {
+ public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getDownloader() {
diff --git a/src/main/java/com/pt/entity/Resource.java b/src/main/java/com/pt/entity/Resource.java
index 2d8567b..9b7da39 100644
--- a/src/main/java/com/pt/entity/Resource.java
+++ b/src/main/java/com/pt/entity/Resource.java
@@ -21,6 +21,7 @@
private String author;
private String description;
+ private byte[] torrentData;
public Resource() {
}
@@ -69,6 +70,13 @@
public void setDescription(String description) {
this.description = description;
}
+ public byte[] getTorrentData() {
+ return torrentData;
+ }
+
+ public void setTorrentData(byte[] torrentData) {
+ this.torrentData = torrentData;
+ }
/*
* 重写toString方法,将资源信息以JSON字符串形式返回
diff --git a/src/main/java/com/pt/entity/TorrentMeta.java b/src/main/java/com/pt/entity/TorrentMeta.java
new file mode 100644
index 0000000..3823181
--- /dev/null
+++ b/src/main/java/com/pt/entity/TorrentMeta.java
@@ -0,0 +1,60 @@
+package com.pt.entity;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+
+import java.time.LocalDateTime;
+
+@Entity
+public class TorrentMeta {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+
+ private String filename;
+ private String infoHash;
+ private Long size;
+ private LocalDateTime uploadTime;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getInfoHash() {
+ return infoHash;
+ }
+
+ public void setInfoHash(String infoHash) {
+ this.infoHash = infoHash;
+ }
+
+ public Long getSize() {
+ return size;
+ }
+
+ public void setSize(Long size) {
+ this.size = size;
+ }
+
+ public LocalDateTime getUploadTime() {
+ return uploadTime;
+ }
+
+ public void setUploadTime(LocalDateTime uploadTime) {
+ this.uploadTime = uploadTime;
+ }
+}
\ No newline at end of file