1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-21 01:10:39 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

去掉文件和文件对象最后修改时间字段

This commit is contained in:
2022-04-23 10:58:47 +08:00
parent 7c452b851d
commit eda6165b2c
14 changed files with 17 additions and 130 deletions

View File

@@ -63,10 +63,9 @@
来源: `<span class="overflow-omit" style="font-size: 10px;">${element.source}</span>`,
大小: `${element.fileSize}`,
"哈希(双击全选)": `<span class="overflow-omit" style="font-size: 10px;">${element.fileSha1}</span>`,
时间: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
创建: ${new Date(element.fileCreateAt).toLocaleString()}<br>
修改: ${new Date(element.fileModifiedAt).toLocaleString()}
</nobr></span>`,
时间: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;">
${new Date(element.fileCreateAt).toLocaleString()}
</span>`,
管理: `<span style="margin: 0 auto;">
<a href="<%= pageUrl %>detail?id=${element.id}">详情</a>
<a href="javascript:deleteFile(${element.id});">删除(TODO)</a>

View File

@@ -53,7 +53,6 @@
<tr><td>是否有广告</td><td>${data.advertising ? "是" : "否"}</td></tr>
<tr><td>是否有水印</td><td>${data.watermark ? "是" : "否"}</td></tr>
<tr><td>文件创建日期</td><td>${data.fileCreateAt}</td></tr>
<tr><td>文件修改日期</td><td>${data.fileModifiedAt}</td></tr>
<tr><td>页数</td><td>${data.numberOfPages}</td></tr>
<tr><td>来源信息</td><td>${data.source}</td></tr>
</table>`;
@@ -84,7 +83,6 @@
var item = data[i];
items.push(`<tr>
<td>${item.id}</td>
<td>${item.lastModified === 0 ? "未知" : new Date(item.lastModified).toISOString().replace(/T/, ' ').replace(/\..+/, '')}</td>
<td>${item.storageMedium}</td>
<td>${item.filePwd}</td>
<td>${item.fileShareCode}</td>
@@ -98,7 +96,6 @@
`<table border="1" style="margin: 0 auto;">
<tr>
<th>文件对象Id</th>
<th>文件修改日期</th>
<th>存储介质</th>
<th>文件密码</th>
<th>提取码</th>

View File

@@ -26,9 +26,6 @@
ID: ${element.fileId}
<a href="<%= pageUrl %>../detail?id=${element.fileId}">查看</a>
</span>`,
修改日期: element.lastModified === 0 ? "未知" : `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
${new Date(element.lastModified).toISOString().replace(/T/, ' ').replace(/\..+/, '')}
</nobr></span>`,
密码: `<span class="overflow-omit" style="font-size: 12px; line-height: 1.2em; display: block;"><nobr>
文件密码: ${element.filePwd}<br>
提取码: ${element.fileShareCode}

View File

@@ -11,7 +11,7 @@
Target Server Version : 50726
File Encoding : 65001
Date: 22/04/2022 17:27:42
Date: 23/04/2022 10:24:36
*/
SET NAMES utf8mb4;
@@ -172,7 +172,6 @@ CREATE TABLE `file_object_info` (
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '本地文件保存相对路径(本地维护用,非线上使用)',
`file_pwd` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`file_share_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`last_modified` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '文件最后修改时间戳',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;

View File

@@ -186,7 +186,6 @@ public class FileController extends BaseController {
FileVO fileVO = new FileVO();
BeanUtils.copyProperties(fileModel, fileVO);
fileVO.setFileCreateAt(fileModel.getFileCreateAt().getTime());
fileVO.setFileModifiedAt(fileModel.getFileModifiedAt().getTime());
return fileVO;
}
}

View File

@@ -26,7 +26,4 @@ public class FileObjectVO {
// 文件提取码
String fileShareCode;
// 文件最后修改时间戳
Long lastModified;
}

View File

@@ -37,7 +37,4 @@ public class FileVO {
// 文件创建时间
long fileCreateAt;
// 文件修改时间
long fileModifiedAt;
}

View File

@@ -102,15 +102,6 @@ public class FileDO {
*/
private Date fileCreateAt;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column file_info.file_modified_at
*
* @mbg.generated
*/
private Date fileModifiedAt;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column file_info.id
@@ -374,28 +365,4 @@ public class FileDO {
public void setFileCreateAt(Date fileCreateAt) {
this.fileCreateAt = fileCreateAt;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column file_info.file_modified_at
*
* @return the value of file_info.file_modified_at
*
* @mbg.generated
*/
public Date getFileModifiedAt() {
return fileModifiedAt;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column file_info.file_modified_at
*
* @param fileModifiedAt the value for file_info.file_modified_at
*
* @mbg.generated
*/
public void setFileModifiedAt(Date fileModifiedAt) {
this.fileModifiedAt = fileModifiedAt;
}
}

View File

@@ -64,15 +64,6 @@ public class FileObjectDO {
*/
private String fileShareCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column file_object_info.last_modified
*
* @mbg.generated
*/
private Long lastModified;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column file_object_info.id
@@ -240,28 +231,4 @@ public class FileObjectDO {
public void setFileShareCode(String fileShareCode) {
this.fileShareCode = fileShareCode == null ? null : fileShareCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column file_object_info.last_modified
*
* @return the value of file_object_info.last_modified
*
* @mbg.generated
*/
public Long getLastModified() {
return lastModified;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column file_object_info.last_modified
*
* @param lastModified the value for file_object_info.last_modified
*
* @mbg.generated
*/
public void setLastModified(Long lastModified) {
this.lastModified = lastModified;
}
}

View File

@@ -156,13 +156,13 @@ public class FileObjectServiceImpl implements FileObjectService {
fileModel.setWatermark(false);
fileModel.setAdvertising(false);
// 获取时间戳为 0 的时间 1970-01-01
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(0);
Date time = calendar.getTime();
calendar.setTimeInMillis(lastModified);
fileModel.setFileCreateAt(calendar.getTime());
fileModel.setFileCreateAt(time);
fileModel.setFileModifiedAt(time);
// 获取时间戳为 0 的时间 1970-01-01 08:00:00
// calendar.setTimeInMillis(0);
// Date time = calendar.getTime();
Boolean isSuccess = fileService.addFile(fileModel);
if (!isSuccess) {
@@ -178,7 +178,6 @@ public class FileObjectServiceImpl implements FileObjectService {
fileObjectModel.setStorageMedium(fileStorageMediumEnum.getStorageMediumName());
fileObjectModel.setFilePath(filePath);
fileObjectModel.setUploadStatus("UPLOADING");
fileObjectModel.setLastModified(lastModified);
// 其余使用默认设置
fileObjectModel.setFilePwd("");

View File

@@ -39,7 +39,4 @@ public class FileModel {
// 文件创建时间
Date fileCreateAt;
// 文件修改时间
Date fileModifiedAt;
}

View File

@@ -26,7 +26,4 @@ public class FileObjectModel {
// 文件提取码
String fileShareCode;
// 文件最后修改时间戳
Long lastModified;
}

View File

@@ -17,7 +17,6 @@
<result column="advertising" jdbcType="BIT" property="advertising" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="file_create_at" jdbcType="TIMESTAMP" property="fileCreateAt" />
<result column="file_modified_at" jdbcType="TIMESTAMP" property="fileModifiedAt" />
</resultMap>
<sql id="Base_Column_List">
<!--
@@ -25,7 +24,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, book_id, file_name, file_ext, file_size, file_sha1, number_of_pages, watermark,
advertising, `source`, file_create_at, file_modified_at
advertising, `source`, file_create_at
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
@@ -53,13 +52,11 @@
insert into file_info (id, book_id, file_name,
file_ext, file_size, file_sha1,
number_of_pages, watermark, advertising,
`source`, file_create_at, file_modified_at
)
`source`, file_create_at)
values (#{id,jdbcType=INTEGER}, #{bookId,jdbcType=INTEGER}, #{fileName,jdbcType=VARCHAR},
#{fileExt,jdbcType=VARCHAR}, #{fileSize,jdbcType=BIGINT}, #{fileSha1,jdbcType=VARCHAR},
#{numberOfPages,jdbcType=INTEGER}, #{watermark,jdbcType=BIT}, #{advertising,jdbcType=BIT},
#{source,jdbcType=VARCHAR}, #{fileCreateAt,jdbcType=TIMESTAMP}, #{fileModifiedAt,jdbcType=TIMESTAMP}
)
#{source,jdbcType=VARCHAR}, #{fileCreateAt,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.FileDO">
<!--
@@ -101,9 +98,6 @@
<if test="fileCreateAt != null">
file_create_at,
</if>
<if test="fileModifiedAt != null">
file_modified_at,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -139,9 +133,6 @@
<if test="fileCreateAt != null">
#{fileCreateAt,jdbcType=TIMESTAMP},
</if>
<if test="fileModifiedAt != null">
#{fileModifiedAt,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="plus.bookshelf.Dao.DO.FileDO">
@@ -181,9 +172,6 @@
<if test="fileCreateAt != null">
file_create_at = #{fileCreateAt,jdbcType=TIMESTAMP},
</if>
<if test="fileModifiedAt != null">
file_modified_at = #{fileModifiedAt,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@@ -202,8 +190,7 @@
watermark = #{watermark,jdbcType=BIT},
advertising = #{advertising,jdbcType=BIT},
`source` = #{source,jdbcType=VARCHAR},
file_create_at = #{fileCreateAt,jdbcType=TIMESTAMP},
file_modified_at = #{fileModifiedAt,jdbcType=TIMESTAMP}
file_create_at = #{fileCreateAt,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectAvailableByBookId" resultMap="BaseResultMap">

View File

@@ -13,15 +13,13 @@
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
<result column="file_pwd" jdbcType="VARCHAR" property="filePwd" />
<result column="file_share_code" jdbcType="VARCHAR" property="fileShareCode" />
<result column="last_modified" jdbcType="BIGINT" property="lastModified" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, file_id, upload_status, storage_medium, file_path, file_pwd, file_share_code,
last_modified
id, file_id, upload_status, storage_medium, file_path, file_pwd, file_share_code
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
@@ -48,10 +46,10 @@
-->
insert into file_object_info (id, file_id, upload_status,
storage_medium, file_path, file_pwd,
file_share_code, last_modified)
file_share_code)
values (#{id,jdbcType=INTEGER}, #{fileId,jdbcType=INTEGER}, #{uploadStatus,jdbcType=VARCHAR},
#{storageMedium,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, #{filePwd,jdbcType=VARCHAR},
#{fileShareCode,jdbcType=VARCHAR}, #{lastModified,jdbcType=BIGINT})
#{fileShareCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.FileObjectDO">
<!--
@@ -81,9 +79,6 @@
<if test="fileShareCode != null">
file_share_code,
</if>
<if test="lastModified != null">
last_modified,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -107,9 +102,6 @@
<if test="fileShareCode != null">
#{fileShareCode,jdbcType=VARCHAR},
</if>
<if test="lastModified != null">
#{lastModified,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="plus.bookshelf.Dao.DO.FileObjectDO">
@@ -137,9 +129,6 @@
<if test="fileShareCode != null">
file_share_code = #{fileShareCode,jdbcType=VARCHAR},
</if>
<if test="lastModified != null">
last_modified = #{lastModified,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@@ -154,8 +143,7 @@
storage_medium = #{storageMedium,jdbcType=VARCHAR},
file_path = #{filePath,jdbcType=VARCHAR},
file_pwd = #{filePwd,jdbcType=VARCHAR},
file_share_code = #{fileShareCode,jdbcType=VARCHAR},
last_modified = #{lastModified,jdbcType=BIGINT}
file_share_code = #{fileShareCode,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectAll" resultMap="BaseResultMap">