mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-10-02 22:15:15 +08:00
添加文件修改日期字段;前端列表小调整
This commit is contained in:
@@ -50,9 +50,6 @@ public class FileController extends BaseController {
|
||||
@Autowired
|
||||
FileObjectServiceImpl fileObjectService;
|
||||
|
||||
// @Autowired
|
||||
// ScheduleTaskServiceImpl scheduleTaskService;
|
||||
|
||||
@ApiOperation(value = "【管理员】查询文件列表", notes = "查询文件列表")
|
||||
@RequestMapping(value = "list", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||
@ResponseBody
|
||||
@@ -131,6 +128,7 @@ public class FileController extends BaseController {
|
||||
// 以下为 PUT 请求必传参数
|
||||
@RequestParam(value = "fileSize", required = false) Long fileSize,
|
||||
// @RequestParam(value = "fileType", required = false) String fileType,
|
||||
@RequestParam(value = "lastModified", required = false) Long lastModified,
|
||||
@RequestParam(value = "fileSha1", required = false) String fileSha1,
|
||||
@RequestParam(value = "fileExt", required = false) String fileExt,
|
||||
@RequestParam(value = "fileId", required = false) Integer fileId // 关联的文件ID,创建新文件则为0
|
||||
@@ -168,7 +166,7 @@ public class FileController extends BaseController {
|
||||
if (isExist) throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "文件已存在");
|
||||
|
||||
fileObjectService.uploadFile(fileId, fileName, bookSaveFolder + fileName, fileSize,
|
||||
fileSha1, fileExt, fileName, FileStorageMediumEnum.QCLOUD_COS, "");
|
||||
fileSha1, fileExt, fileName, FileStorageMediumEnum.QCLOUD_COS, "", lastModified);
|
||||
break;
|
||||
case GET:
|
||||
if (!isExist) throw new BusinessException(BusinessErrorCode.PARAMETER_VALIDATION_ERROR, "文件不存在");
|
||||
@@ -190,6 +188,7 @@ public class FileController extends BaseController {
|
||||
|
||||
/**
|
||||
* 腾讯云 COS 文件上传成功回调方法
|
||||
*
|
||||
* @param eventStr
|
||||
* @param contextStr
|
||||
* @return
|
||||
|
@@ -33,6 +33,9 @@ public class FileObjectVO {
|
||||
// 文件提取码
|
||||
String fileShareCode;
|
||||
|
||||
// 文件最后修改时间戳
|
||||
Long lastModified;
|
||||
|
||||
// 文件上传状态
|
||||
String uploadStatus;
|
||||
|
||||
|
@@ -100,6 +100,15 @@ public class FileObjectDO {
|
||||
*/
|
||||
private String fileSha1;
|
||||
|
||||
/**
|
||||
*
|
||||
* 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 field was generated by MyBatis Generator.
|
||||
@@ -373,6 +382,30 @@ public class FileObjectDO {
|
||||
this.fileSha1 = fileSha1 == null ? null : fileSha1.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;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column file_object_info.additional_fields
|
||||
|
@@ -107,7 +107,7 @@ public class FileObjectServiceImpl implements FileObjectService {
|
||||
@Transactional
|
||||
public Boolean uploadFile(Integer fileId, String fileName, String filePath, Long fileSize, String fileSHA1,
|
||||
String fileExt, String fileNameWithoutExt, FileStorageMediumEnum fileStorageMediumEnum,
|
||||
String bookOrigin
|
||||
String bookOrigin, Long lastModified
|
||||
) throws InvocationTargetException, IllegalAccessException, BusinessException {
|
||||
|
||||
if (fileId == 0) {
|
||||
@@ -153,6 +153,7 @@ public class FileObjectServiceImpl implements FileObjectService {
|
||||
fileObjectModel.setFilePath(filePath);
|
||||
fileObjectModel.setFileSha1(fileSHA1);
|
||||
fileObjectModel.setUploadStatus("UPLOADING");
|
||||
fileObjectModel.setLastModified(lastModified);
|
||||
|
||||
// 其余使用默认设置
|
||||
fileObjectModel.setFilePwd("");
|
||||
|
@@ -33,6 +33,9 @@ public class FileObjectModel {
|
||||
// 文件提取码
|
||||
String fileShareCode;
|
||||
|
||||
// 文件最后修改时间戳
|
||||
Long lastModified;
|
||||
|
||||
// 文件上传状态
|
||||
String uploadStatus;
|
||||
|
||||
|
@@ -45,7 +45,7 @@ public interface FileObjectService {
|
||||
* @throws BusinessException
|
||||
*/
|
||||
@Transactional
|
||||
Boolean uploadFile(Integer fileId, String fileName, String filePath, Long fileSize, String fileSHA1, String fileExt, String fileNameWithoutExt, FileStorageMediumEnum fileStorageMediumEnum, String bookOrigin) throws InvocationTargetException, IllegalAccessException, BusinessException;
|
||||
Boolean uploadFile(Integer fileId, String fileName, String filePath, Long fileSize, String fileSHA1, String fileExt, String fileNameWithoutExt, FileStorageMediumEnum fileStorageMediumEnum, String bookOrigin, Long lastModified) throws InvocationTargetException, IllegalAccessException, BusinessException;
|
||||
|
||||
/**
|
||||
* 修改文件对象上传状态信息
|
||||
|
@@ -17,6 +17,7 @@
|
||||
<result column="file_share_code" jdbcType="VARCHAR" property="fileShareCode" />
|
||||
<result column="upload_status" jdbcType="VARCHAR" property="uploadStatus" />
|
||||
<result column="file_sha1" jdbcType="VARCHAR" property="fileSha1" />
|
||||
<result column="last_modified" jdbcType="BIGINT" property="lastModified" />
|
||||
<result column="additional_fields" jdbcType="VARCHAR" property="additionalFields" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
@@ -25,7 +26,7 @@
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, file_id, file_name, file_size, file_type, storage_medium_type, file_path, file_pwd,
|
||||
file_share_code, upload_status, file_sha1, additional_fields
|
||||
file_share_code, upload_status, file_sha1, last_modified, additional_fields
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--
|
||||
@@ -53,13 +54,13 @@
|
||||
insert into file_object_info (id, file_id, file_name,
|
||||
file_size, file_type, storage_medium_type,
|
||||
file_path, file_pwd, file_share_code,
|
||||
upload_status, file_sha1, additional_fields
|
||||
)
|
||||
upload_status, file_sha1, last_modified,
|
||||
additional_fields)
|
||||
values (#{id,jdbcType=INTEGER}, #{fileId,jdbcType=INTEGER}, #{fileName,jdbcType=VARCHAR},
|
||||
#{fileSize,jdbcType=BIGINT}, #{fileType,jdbcType=VARCHAR}, #{storageMediumType,jdbcType=VARCHAR},
|
||||
#{filePath,jdbcType=VARCHAR}, #{filePwd,jdbcType=VARCHAR}, #{fileShareCode,jdbcType=VARCHAR},
|
||||
#{uploadStatus,jdbcType=VARCHAR}, #{fileSha1,jdbcType=VARCHAR}, #{additionalFields,jdbcType=VARCHAR}
|
||||
)
|
||||
#{uploadStatus,jdbcType=VARCHAR}, #{fileSha1,jdbcType=VARCHAR}, #{lastModified,jdbcType=BIGINT},
|
||||
#{additionalFields,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="plus.bookshelf.Dao.DO.FileObjectDO">
|
||||
<!--
|
||||
@@ -101,6 +102,9 @@
|
||||
<if test="fileSha1 != null">
|
||||
file_sha1,
|
||||
</if>
|
||||
<if test="lastModified != null">
|
||||
last_modified,
|
||||
</if>
|
||||
<if test="additionalFields != null">
|
||||
additional_fields,
|
||||
</if>
|
||||
@@ -139,6 +143,9 @@
|
||||
<if test="fileSha1 != null">
|
||||
#{fileSha1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lastModified != null">
|
||||
#{lastModified,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="additionalFields != null">
|
||||
#{additionalFields,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -181,6 +188,9 @@
|
||||
<if test="fileSha1 != null">
|
||||
file_sha1 = #{fileSha1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lastModified != null">
|
||||
last_modified = #{lastModified,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="additionalFields != null">
|
||||
additional_fields = #{additionalFields,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -203,6 +213,7 @@
|
||||
file_share_code = #{fileShareCode,jdbcType=VARCHAR},
|
||||
upload_status = #{uploadStatus,jdbcType=VARCHAR},
|
||||
file_sha1 = #{fileSha1,jdbcType=VARCHAR},
|
||||
last_modified = #{lastModified,jdbcType=BIGINT},
|
||||
additional_fields = #{additionalFields,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
Reference in New Issue
Block a user