🐛 fixed file

This commit is contained in:
毛毛虫 2022-01-13 10:32:43 +08:00
parent 97d08c4c7e
commit 245b359481
5 changed files with 40 additions and 31 deletions

View File

@ -12,7 +12,7 @@ import java.util.Date;
* @author caterpillar * @author caterpillar
*/ */
@Data @Data
@Table(name = "forest_File") @Table(name = "forest_file")
public class ForestFile { public class ForestFile {
/** /**
@ -26,14 +26,14 @@ public class ForestFile {
/** /**
* 访问路径 * 访问路径
*/ */
@Column(name = "web_path") @Column(name = "file_url")
private String webPath; private String fileUrl;
/** /**
* 上传路径 * 上传路径
*/ */
@Column(name = "upload_path") @Column(name = "file_path")
private String uploadPath; private String filePath;
/** /**
* md5 * md5
@ -44,14 +44,20 @@ public class ForestFile {
/** /**
* 创建时间 * 创建时间
*/ */
@Column(name = "create_time") @Column(name = "created_time")
private Date createTime; private Date createdTime;
/** /**
* 更新时间 * 更新时间
*/ */
@Column(name = "update_time") @Column(name = "updated_time")
private Date updateTime; private Date updatedTime;
/**
* 创建人
*/
@Column(name = "created_by")
private long createdBy;
} }

View File

@ -16,7 +16,7 @@ public interface ForestFileMapper extends Mapper<ForestFile> {
* @param md5Value md5值 * @param md5Value md5值
* @return * @return
*/ */
ForestFile getByMd5(@Param("md5Value") String md5Value); ForestFile getForestFileByMd5(@Param("md5Value") String md5Value);
/** /**
* 插入文件对象 * 插入文件对象
@ -24,7 +24,8 @@ public interface ForestFileMapper extends Mapper<ForestFile> {
* @param webPath 访问路径 * @param webPath 访问路径
* @param uploadPath 上传路径 * @param uploadPath 上传路径
* @param md5Value md5值 * @param md5Value md5值
* @param createdBy 创建人
* @return * @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);
} }

View File

@ -2,7 +2,6 @@ package com.rymcu.forest.service;
import com.rymcu.forest.core.service.Service; import com.rymcu.forest.core.service.Service;
import com.rymcu.forest.entity.ForestFile; import com.rymcu.forest.entity.ForestFile;
import org.apache.ibatis.annotations.Param;
/** /**
@ -19,15 +18,16 @@ public interface ForestFileService extends Service<ForestFile> {
* @param md5Value md5值 * @param md5Value md5值
* @return * @return
*/ */
ForestFile getByMd5(@Param("md5Value") String md5Value); ForestFile getForestFileByMd5(String md5Value);
/** /**
* 插入文件对象 * 插入文件对象
* *
* @param webPath 访问路径 * @param fileUrl 访问路径
* @param uploadPath 上传路径 * @param filePath 上传路径
* @param md5Value md5值 * @param md5Value md5值
* @param createdBy 创建人
* @return * @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);
} }

View File

@ -28,20 +28,21 @@ public class ForestFileServiceImpl extends AbstractService<ForestFile> implement
* @return * @return
*/ */
@Override @Override
public ForestFile getByMd5(String md5Value) { public ForestFile getForestFileByMd5(String md5Value) {
return forestFileMapper.getByMd5(md5Value); return forestFileMapper.getForestFileByMd5(md5Value);
} }
/** /**
* 插入文件对象 * 插入文件对象
* *
* @param webPath 访问路径 * @param fileUrl 访问路径
* @param uploadPath 上传路径 * @param filePath 上传路径
* @param md5Value md5值 * @param md5Value md5值
* @param createdBy 创建人
* @return * @return
*/ */
@Override @Override
public int insert(String webPath, String uploadPath, String md5Value) { public int insert(String fileUrl, String filePath, String md5Value, long createdBy) {
return forestFileMapper.insert(webPath, uploadPath, md5Value); return forestFileMapper.insert(fileUrl, filePath, md5Value, createdBy);
} }
} }

View File

@ -4,18 +4,19 @@
<resultMap id="BaseResultMap" type="com.rymcu.forest.entity.ForestFile"> <resultMap id="BaseResultMap" type="com.rymcu.forest.entity.ForestFile">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="md5_value" property="md5Value"/> <result column="md5_value" property="md5Value"/>
<result column="upload_path" property="uploadPath"/> <result column="file_path" property="filePath"/>
<result column="web_path" property="webPath"/> <result column="file_url" property="fileUrl"/>
<result column="create_time" property="createTime"/> <result column="created_time" property="createdTime"/>
<result column="update_time" property="updateTime"/> <result column="updated_time" property="updatedTime"/>
<result column="created_by" property="createdBy"/>
</resultMap> </resultMap>
<insert id="insert"> <insert id="insert">
insert into forest_user_role (md5, upload_path, web_path, created_time) insert into forest_user_role (md5, file_path, file_url, created_time, created_by)
values (#{md5Value}, #{uploadPath}, #{webPath}, sysdate()) values (#{md5Value}, #{filePath}, #{fileUrl}, sysdate(), #{createdBy})
</insert> </insert>
<select id="getByMd5" resultMap="BaseResultMap"> <select id="getForestFileByMd5" resultMap="BaseResultMap">
select * select *
from forest_file from forest_file
where md5_value = #{md5Value} where md5_value = #{md5Value}