From 245b3594812acddcbbba2069d337579801a729fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AF=9B=E6=AF=9B=E8=99=AB?= <1421374934@qq.com> Date: Thu, 13 Jan 2022 10:32:43 +0800 Subject: [PATCH] :bug: fixed file --- .../com/rymcu/forest/entity/ForestFile.java | 24 ++++++++++++------- .../rymcu/forest/mapper/ForestFileMapper.java | 5 ++-- .../forest/service/ForestFileService.java | 12 +++++----- .../service/impl/ForestFileServiceImpl.java | 15 ++++++------ src/main/java/mapper/ForestFileMapper.xml | 15 ++++++------ 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/rymcu/forest/entity/ForestFile.java b/src/main/java/com/rymcu/forest/entity/ForestFile.java index d277c71..d2c3f4d 100644 --- a/src/main/java/com/rymcu/forest/entity/ForestFile.java +++ b/src/main/java/com/rymcu/forest/entity/ForestFile.java @@ -12,7 +12,7 @@ import java.util.Date; * @author caterpillar */ @Data -@Table(name = "forest_File") +@Table(name = "forest_file") public class ForestFile { /** @@ -26,14 +26,14 @@ public class ForestFile { /** * 访问路径 */ - @Column(name = "web_path") - private String webPath; + @Column(name = "file_url") + private String fileUrl; /** * 上传路径 */ - @Column(name = "upload_path") - private String uploadPath; + @Column(name = "file_path") + private String filePath; /** * md5 @@ -44,14 +44,20 @@ public class ForestFile { /** * 创建时间 */ - @Column(name = "create_time") - private Date createTime; + @Column(name = "created_time") + private Date createdTime; /** * 更新时间 */ - @Column(name = "update_time") - private Date updateTime; + @Column(name = "updated_time") + private Date updatedTime; + + /** + * 创建人 + */ + @Column(name = "created_by") + private long createdBy; } diff --git a/src/main/java/com/rymcu/forest/mapper/ForestFileMapper.java b/src/main/java/com/rymcu/forest/mapper/ForestFileMapper.java index 76a02a9..359ff50 100644 --- a/src/main/java/com/rymcu/forest/mapper/ForestFileMapper.java +++ b/src/main/java/com/rymcu/forest/mapper/ForestFileMapper.java @@ -16,7 +16,7 @@ public interface ForestFileMapper extends Mapper { * @param md5Value md5值 * @return */ - ForestFile getByMd5(@Param("md5Value") String md5Value); + ForestFile getForestFileByMd5(@Param("md5Value") String md5Value); /** * 插入文件对象 @@ -24,7 +24,8 @@ public interface ForestFileMapper extends Mapper { * @param webPath 访问路径 * @param uploadPath 上传路径 * @param md5Value md5值 + * @param createdBy 创建人 * @return */ - int insert(@Param("webPath") String webPath, @Param("uploadPath") String uploadPath, @Param("md5Value") String md5Value); + int insert(@Param("webPath") String webPath, @Param("uploadPath") String uploadPath, @Param("md5Value") String md5Value, @Param("createdBy") long createdBy); } diff --git a/src/main/java/com/rymcu/forest/service/ForestFileService.java b/src/main/java/com/rymcu/forest/service/ForestFileService.java index e2e2bac..d4d8362 100644 --- a/src/main/java/com/rymcu/forest/service/ForestFileService.java +++ b/src/main/java/com/rymcu/forest/service/ForestFileService.java @@ -2,7 +2,6 @@ package com.rymcu.forest.service; import com.rymcu.forest.core.service.Service; import com.rymcu.forest.entity.ForestFile; -import org.apache.ibatis.annotations.Param; /** @@ -19,15 +18,16 @@ public interface ForestFileService extends Service { * @param md5Value md5值 * @return */ - ForestFile getByMd5(@Param("md5Value") String md5Value); + ForestFile getForestFileByMd5(String md5Value); /** * 插入文件对象 * - * @param webPath 访问路径 - * @param uploadPath 上传路径 - * @param md5Value md5值 + * @param fileUrl 访问路径 + * @param filePath 上传路径 + * @param md5Value md5值 + * @param createdBy 创建人 * @return */ - int insert(@Param("webPath") String webPath, @Param("uploadPath") String uploadPath, @Param("md5Value") String md5Value); + int insert(String fileUrl, String filePath, String md5Value, long createdBy); } diff --git a/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java index 21f8d52..ed87d5d 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ForestFileServiceImpl.java @@ -28,20 +28,21 @@ public class ForestFileServiceImpl extends AbstractService implement * @return */ @Override - public ForestFile getByMd5(String md5Value) { - return forestFileMapper.getByMd5(md5Value); + public ForestFile getForestFileByMd5(String md5Value) { + return forestFileMapper.getForestFileByMd5(md5Value); } /** * 插入文件对象 * - * @param webPath 访问路径 - * @param uploadPath 上传路径 - * @param md5Value md5值 + * @param fileUrl 访问路径 + * @param filePath 上传路径 + * @param md5Value md5值 + * @param createdBy 创建人 * @return */ @Override - public int insert(String webPath, String uploadPath, String md5Value) { - return forestFileMapper.insert(webPath, uploadPath, md5Value); + public int insert(String fileUrl, String filePath, String md5Value, long createdBy) { + return forestFileMapper.insert(fileUrl, filePath, md5Value, createdBy); } } diff --git a/src/main/java/mapper/ForestFileMapper.xml b/src/main/java/mapper/ForestFileMapper.xml index 0443d01..8e9080b 100644 --- a/src/main/java/mapper/ForestFileMapper.xml +++ b/src/main/java/mapper/ForestFileMapper.xml @@ -4,18 +4,19 @@ - - - - + + + + + - insert into forest_user_role (md5, upload_path, web_path, created_time) - values (#{md5Value}, #{uploadPath}, #{webPath}, sysdate()) + insert into forest_user_role (md5, file_path, file_url, created_time, created_by) + values (#{md5Value}, #{filePath}, #{fileUrl}, sysdate(), #{createdBy}) - select * from forest_file where md5_value = #{md5Value}