种子,促销

Change-Id: I0ce919ce4228dcefec26ef636bacd3298c0dc77a
diff --git a/src/main/java/com/example/myproject/entity/EntityBase.java b/src/main/java/com/example/myproject/entity/EntityBase.java
new file mode 100644
index 0000000..48583cb
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/EntityBase.java
@@ -0,0 +1,61 @@
+package com.example.myproject.entity;
+
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.util.Objects;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * Base class for an entity, as explained in the book "Domain Driven Design".
+ * All entities in this project have an identity attribute with type Long and
+ * name id. Inspired by the DDD Sample project.
+
+ */
+@Setter
+@Getter
+public abstract class EntityBase {
+
+    /**
+     * This identity field has the wrapper class type Long so that an entity which
+     * has not been saved is recognizable by a null identity.
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    @Override
+    public boolean equals(final Object object) {
+        if (!(object instanceof EntityBase)) {
+            return false;
+        }
+        if (!getClass().equals(object.getClass())) {
+            return false;
+        }
+        final EntityBase that = (EntityBase) object;
+        _checkIdentity(this);
+        _checkIdentity(that);
+        return this.id.equals(that.getId());
+    }
+
+
+    private void _checkIdentity(final EntityBase entity) {
+        if (entity.getId() == null) {
+            throw new IllegalStateException("Comparison identity missing in entity: " + entity);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(this.getId());
+    }
+
+    @Override
+    public String toString() {
+        return this.getClass().getSimpleName() + "<" + getId() + ">";
+    }
+
+}
diff --git a/src/main/java/com/example/myproject/entity/FavoriteEntity.java b/src/main/java/com/example/myproject/entity/FavoriteEntity.java
new file mode 100644
index 0000000..3f76cfe
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/FavoriteEntity.java
@@ -0,0 +1,36 @@
+package com.example.myproject.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("favorite")
+@ApiModel("收藏实体类")
+public class FavoriteEntity {
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "收藏ID", example = "1")
+    private Long id;
+
+    @ApiModelProperty(value = "用户ID", example = "1001")
+    @JsonProperty("userId")
+    @TableField("user_id")
+    private Long userId;
+
+    @ApiModelProperty(value = "种子ID", example = "2001")
+    @JsonProperty("seedId")
+    @TableField("seed_id")
+    private Long seedId;
+
+    @ApiModelProperty(value = "收藏时间", example = "2024-05-13 12:00:00")
+    @JsonProperty("createTime")
+    @TableField("create_time")
+    private Date createTime;
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/myproject/entity/Promotion.java b/src/main/java/com/example/myproject/entity/Promotion.java
new file mode 100644
index 0000000..4ca846b
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/Promotion.java
@@ -0,0 +1,34 @@
+package com.example.myproject.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Data
+@TableName("promotion")
+public class Promotion {
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    
+    private String name;
+    
+    private String description;
+    
+    private LocalDateTime startTime;
+    
+    private LocalDateTime endTime;
+    
+    private double discountPercentage;
+    
+    private String applicableTorrentIds;
+    
+    private LocalDateTime createTime;
+    
+    private LocalDateTime updateTime;
+    
+    private Boolean isDeleted;
+} 
\ No newline at end of file
diff --git a/src/main/java/com/example/myproject/entity/TorrentEntity.java b/src/main/java/com/example/myproject/entity/TorrentEntity.java
new file mode 100644
index 0000000..f62fb76
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/TorrentEntity.java
@@ -0,0 +1,108 @@
+package com.example.myproject.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@TableName("torrent")
+@ApiModel("种子实体类")
+public class TorrentEntity {
+
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "种子ID", example = "1")
+    private Long id;
+
+    @JsonProperty("infoHash")
+    @ApiModelProperty(value = "种子信息哈希", example = "abcdef123456")
+    private String infoHash;
+
+    @JsonProperty("fileName")
+    @ApiModelProperty(value = "种子文件名", example = "movie_torrent_file.torrent")
+    private String fileName;
+
+    @JsonProperty("uploader")
+    @ApiModelProperty(value = "上传者", example = "user123")
+    private String uploader;
+
+    @JsonProperty("createdTime")
+    @ApiModelProperty(value = "上传时间", example = "2024-01-01 12:00:00")
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    @JsonProperty("updateTime")
+    @ApiModelProperty(value = "更新时间", example = "2024-01-01 12:00:00")
+
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime updateTime;
+
+    @JsonProperty("size")
+    @ApiModelProperty(value = "种子文件大小", example = "123456")
+    private Long size;
+
+    @JsonProperty("title")
+    @ApiModelProperty(value = "种子标题", example = "《星际穿越》")
+    private String title;
+
+    @JsonProperty("description")
+    @ApiModelProperty(value = "种子描述", example = "这是一部好看的科幻电影")
+    private String description;
+
+    @JsonProperty("tags")
+    @ApiModelProperty(value = "种子标签", example = "[\"科幻\",\"动作\"]")
+    private String tags;
+
+    @JsonProperty("category")
+    @ApiModelProperty(value = "种子分类", example = "movie")
+    private String category;
+
+    @JsonProperty("imageUrl")
+    @ApiModelProperty(value = "种子封面图URL", example = "http://example.com/images/cover.jpg")
+    private String imageUrl;
+
+    @JsonProperty("leechers")
+    @ApiModelProperty(value = "下载次数", example = "123")
+    private Integer leechers;
+
+    @JsonProperty("seeders")
+    @ApiModelProperty(value = "做种数", example = "10")
+    private Integer seeders;
+
+    @JsonProperty("comments")
+    @ApiModelProperty(value = "评论数", example = "5")
+    private Integer comments;
+
+    @JsonProperty("views")
+    @ApiModelProperty(value = "浏览次数", example = "1000")
+    private Integer views;
+
+    @JsonProperty("hits")
+    @ApiModelProperty(value = "点击次数", example = "2000")
+    private Integer hits;
+
+    @JsonProperty("promotionTimeType")
+    @ApiModelProperty(value = "促销时间类型", example = "1")
+    private Integer promotionTimeType;
+
+    @JsonProperty("promotionUntil")
+    @ApiModelProperty(value = "促销截止日期", example = "2024-12-31T23:59:59")
+    private LocalDateTime promotionUntil;
+
+    
+    @JsonProperty("torrentFile")
+    @ApiModelProperty(value = "种子文件", example = "base64 encoded torrent file")
+    private byte[] torrentFile;
+
+    @JsonProperty("isDeleted")
+    @ApiModelProperty(value = "是否删除", example = "false")
+    private Boolean isDeleted;
+
+    public TorrentEntity() {
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/myproject/entity/User.java b/src/main/java/com/example/myproject/entity/User.java
index 20f7138..7574e67 100644
--- a/src/main/java/com/example/myproject/entity/User.java
+++ b/src/main/java/com/example/myproject/entity/User.java
@@ -9,6 +9,8 @@
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
 @Data
 @TableName("user") // 指定数据库表名
 @ApiModel("用户实体类") // 用于描述模型
@@ -50,6 +52,26 @@
     @ApiModelProperty(value = "头像")
     private String avatar;
 
+    @JsonProperty("uploaded")
+    @ApiModelProperty(value = "上传量", example = "1000")
+    private Long uploaded;
+
+    @JsonProperty("downloaded")
+    @ApiModelProperty(value = "下载量", example = "500")
+    private Long downloaded;
+
+    @JsonProperty("create_time")
+    @ApiModelProperty(value = "创建时间", example = "2024-04-01T12:00:00")
+    private LocalDateTime createTime;
+
+    @JsonProperty("update_time")
+    @ApiModelProperty(value = "更新时间", example = "2024-04-01T12:00:00")
+    private LocalDateTime updateTime;
+
+    @JsonProperty("is_deleted")
+    @ApiModelProperty(value = "是否删除", example = "false")
+    private Boolean isDeleted;
+
     public User() {
     }
 }