文件查询开启缓存

This commit is contained in:
wenc000 2020-11-30 11:17:58 +08:00
parent 4e91931b9e
commit 6208ce0b43
3 changed files with 19 additions and 11 deletions

View File

@ -2,6 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.common.plugin.dao.file.IFileDao"> <mapper namespace="com.cm.common.plugin.dao.file.IFileDao">
<cache/>
<resultMap id="filePO" type="com.cm.common.pojo.pos.FilePO"> <resultMap id="filePO" type="com.cm.common.pojo.pos.FilePO">
<id property="fileId" column="file_id"/> <id property="fileId" column="file_id"/>
<result property="fileName" column="file_name"/> <result property="fileName" column="file_name"/>
@ -50,7 +52,7 @@
</resultMap> </resultMap>
<!-- 保存文件 --> <!-- 保存文件 -->
<insert id="saveFile" parameterType="map"> <insert id="saveFile" parameterType="map" flushCache="true">
INSERT INTO sys_file( INSERT INTO sys_file(
file_id, file_id,
file_name, file_name,
@ -83,7 +85,7 @@
</insert> </insert>
<!-- 删除文件 --> <!-- 删除文件 -->
<update id="removeFile" parameterType="map"> <update id="removeFile" parameterType="map" flushCache="true">
UPDATE UPDATE
sys_file sys_file
SET SET
@ -98,7 +100,7 @@
</update> </update>
<!-- 删除文件(物理删除) --> <!-- 删除文件(物理删除) -->
<delete id="deleteFile" parameterType="map"> <delete id="deleteFile" parameterType="map" flushCache="true">
DELETE FROM DELETE FROM
sys_file sys_file
WHERE WHERE
@ -109,7 +111,7 @@
</delete> </delete>
<!-- 更新文件描述 --> <!-- 更新文件描述 -->
<update id="updateFileSummary" parameterType="map"> <update id="updateFileSummary" parameterType="map" flushCache="true">
UPDATE UPDATE
sys_file sys_file
SET SET
@ -127,7 +129,7 @@
</update> </update>
<!-- 获取文件 --> <!-- 获取文件 -->
<select id="getFile" parameterType="map" resultMap="filePO"> <select id="getFile" parameterType="map" resultMap="filePO" useCache="true">
SELECT SELECT
file_id, file_id,
file_name, file_name,
@ -151,7 +153,7 @@
</select> </select>
<!-- 文件列表 --> <!-- 文件列表 -->
<select id="listFile" parameterType="map" resultMap="fileDTO"> <select id="listFile" parameterType="map" resultMap="fileDTO" useCache="true">
SELECT SELECT
file_id, file_id,
file_name, file_name,
@ -200,7 +202,7 @@
</select> </select>
<!-- 文件列表 --> <!-- 文件列表 -->
<select id="listFileInfo" parameterType="map" resultMap="fileInfoDTO"> <select id="listFileInfo" parameterType="map" resultMap="fileInfoDTO" useCache="false">
SELECT SELECT
file_id, file_id,
file_name, file_name,
@ -241,7 +243,7 @@
</select> </select>
<!-- 获取文件列表(带路径) --> <!-- 获取文件列表(带路径) -->
<select id="listFileInfoWithPath" parameterType="map" resultMap="fileInfoWithPathDTO"> <select id="listFileInfoWithPath" parameterType="map" resultMap="fileInfoWithPathDTO" useCache="false">
SELECT SELECT
file_id, file_id,
file_name, file_name,
@ -270,7 +272,7 @@
</select> </select>
<!-- 文件列表 --> <!-- 文件列表 -->
<select id="listFileByMd5" parameterType="java.lang.String" resultMap="fileInfoDTO"> <select id="listFileByMd5" parameterType="java.lang.String" resultMap="fileInfoDTO" useCache="false">
SELECT SELECT
file_id, file_id,
file_name, file_name,

View File

@ -3,6 +3,8 @@ package com.cm.common.pojo.dtos;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/** /**
* @ClassName: FileDTO * @ClassName: FileDTO
* @Description: 文件 * @Description: 文件
@ -11,8 +13,9 @@ import io.swagger.annotations.ApiModelProperty;
* @Version: 1.0 * @Version: 1.0
**/ **/
@ApiModel @ApiModel
public class FileDTO { public class FileDTO implements Serializable {
private static final long serialVersionUID = 3765953896919360869L;
@ApiModelProperty(name = "fileId", value = "文件ID") @ApiModelProperty(name = "fileId", value = "文件ID")
private String fileId; private String fileId;
@ApiModelProperty(name = "fileName", value = "文件名称") @ApiModelProperty(name = "fileName", value = "文件名称")

View File

@ -1,5 +1,7 @@
package com.cm.common.pojo.pos; package com.cm.common.pojo.pos;
import java.io.Serializable;
/** /**
* @ClassName: FilePO * @ClassName: FilePO
* @Description: 文件 * @Description: 文件
@ -7,8 +9,9 @@ package com.cm.common.pojo.pos;
* @Date: 2019/1/4 11:57 AM * @Date: 2019/1/4 11:57 AM
* @Version: 1.0 * @Version: 1.0
**/ **/
public class FilePO { public class FilePO implements Serializable {
private static final long serialVersionUID = -118382389804178231L;
private String fileId; private String fileId;
private String fileName; private String fileName;
private String filePath; private String filePath;