diff --git a/src/main/java/im/zhaojun/zfile/module/log/model/entity/DownloadLog.java b/src/main/java/im/zhaojun/zfile/module/log/model/entity/DownloadLog.java index 68e2efd..3540913 100644 --- a/src/main/java/im/zhaojun/zfile/module/log/model/entity/DownloadLog.java +++ b/src/main/java/im/zhaojun/zfile/module/log/model/entity/DownloadLog.java @@ -27,6 +27,10 @@ import java.util.Date; @NoArgsConstructor public class DownloadLog implements Serializable { + public static final String DOWNLOAD_TYPE_DIRECT_LINK = "directLink"; + + public static final String DOWNLOAD_TYPE_SHORT_LINK = "shortLink"; + private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.INPUT) @@ -34,6 +38,11 @@ public class DownloadLog implements Serializable { private Integer id; + @TableField(value = "`download_type`") + @ApiModelProperty(value="下载类型", example = "directLink", allowableValues = "directLink, shortLink") + private String downloadType; + + @TableField(value = "`path`") @ApiModelProperty(value="文件路径") private String path; @@ -68,7 +77,8 @@ public class DownloadLog implements Serializable { @ApiModelProperty(value="访问 referer") private String referer; - public DownloadLog(String path, String storageKey, String shortKey) { + public DownloadLog(String downloadType, String path, String storageKey, String shortKey) { + this.downloadType = downloadType; this.path = path; this.storageKey = storageKey; this.shortKey = shortKey; diff --git a/src/main/resources/db/migration-mysql/V18__download_log_add_field_download_type.sql b/src/main/resources/db/migration-mysql/V18__download_log_add_field_download_type.sql new file mode 100644 index 0000000..60b2210 --- /dev/null +++ b/src/main/resources/db/migration-mysql/V18__download_log_add_field_download_type.sql @@ -0,0 +1 @@ +alter table download_log add download_type varchar(32); \ No newline at end of file diff --git a/src/main/resources/db/migration-sqlite/V18__download_log_add_field_download_type.sql b/src/main/resources/db/migration-sqlite/V18__download_log_add_field_download_type.sql new file mode 100644 index 0000000..60b2210 --- /dev/null +++ b/src/main/resources/db/migration-sqlite/V18__download_log_add_field_download_type.sql @@ -0,0 +1 @@ +alter table download_log add download_type varchar(32); \ No newline at end of file diff --git a/src/main/resources/mapper/DownloadLogMapper.xml b/src/main/resources/mapper/DownloadLogMapper.xml index 12dc3ac..49309ab 100644 --- a/src/main/resources/mapper/DownloadLogMapper.xml +++ b/src/main/resources/mapper/DownloadLogMapper.xml @@ -12,10 +12,11 @@ + - `id`, `path`, `storage_key`, `create_time`, `ip`, `user_agent`, `referer`, `short_key` + `id`, `path`, `storage_key`, `create_time`, `ip`, `user_agent`, `referer`, `short_key`, `download_type`