2019-01-19 15:31:26 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.central.file.mapper.FileMapper">
|
|
|
|
|
|
|
|
|
|
<sql id="where">
|
|
|
|
|
<where>
|
|
|
|
|
<if test="f.name != null and f.name != ''">
|
|
|
|
|
and t.name like concat('%', #{f.name}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="f.beginTime != null and f.beginTime != ''">
|
|
|
|
|
and t.create_time >= #{f.beginTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="f.endTime != null and f.endTime != ''">
|
|
|
|
|
and t.create_time <= #{f.endTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="f.searchKey != null and f.searchKey != ''">
|
|
|
|
|
and t.name like concat('%', #{f.searchKey}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
|
2025-01-21 10:31:51 +08:00
|
|
|
<select id="findList" resultType="com.central.common.model.FileInfo">
|
2019-01-19 15:31:26 +08:00
|
|
|
select * from file_info t
|
2025-02-17 15:01:22 +08:00
|
|
|
<include refid= "where" />
|
2019-01-19 15:31:26 +08:00
|
|
|
order by t.create_time desc
|
|
|
|
|
</select>
|
2025-01-25 13:21:29 +08:00
|
|
|
|
|
|
|
|
<select id="findById" resultType="com.central.common.model.FileInfo">
|
|
|
|
|
SELECT * FROM file_info WHERE id = #{id}
|
|
|
|
|
</select>
|
2025-07-01 10:34:39 +08:00
|
|
|
|
|
|
|
|
<!-- 查询文件列表 -->
|
|
|
|
|
<select id="findList" resultType="com.central.common.model.FileInfo">
|
|
|
|
|
SELECT * FROM file_info
|
|
|
|
|
<where>
|
|
|
|
|
<if test="params.name != null and params.name != ''">
|
|
|
|
|
AND name LIKE CONCAT('%', #{params.name}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.contentType != null and params.contentType != ''">
|
|
|
|
|
AND content_type LIKE CONCAT('%', #{params.contentType}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.storageType != null and params.storageType != ''">
|
|
|
|
|
AND storage_type = #{params.storageType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.isImg != null">
|
|
|
|
|
AND is_img = #{params.isImg}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY createTime DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询热数据文件列表 -->
|
|
|
|
|
<select id="selectHotDataFiles" resultType="com.central.common.model.FileInfo">
|
|
|
|
|
SELECT * FROM file_info
|
|
|
|
|
WHERE create_time >= #{hotDataThreshold}
|
|
|
|
|
AND size > 0
|
|
|
|
|
AND (storage_type IS NULL OR storage_type NOT LIKE '%S3%' OR storage_type NOT LIKE '%MINIO%')
|
|
|
|
|
AND (path IS NULL OR path NOT LIKE '%s3://%' OR path NOT LIKE '%minio%')
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
LIMIT #{limit}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 根据存储类型查询文件 -->
|
|
|
|
|
<select id="selectFilesByStorageType" resultType="com.central.common.model.FileInfo">
|
|
|
|
|
SELECT * FROM file_info
|
|
|
|
|
WHERE storage_type = #{storageType}
|
|
|
|
|
AND size > 0
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
LIMIT #{limit}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询需要同步的文件(不在S3中的OSS文件) -->
|
|
|
|
|
<select id="selectFilesNeedSync" resultType="com.central.common.model.FileInfo">
|
|
|
|
|
SELECT * FROM file_info
|
|
|
|
|
WHERE (storage_type IS NULL OR storage_type NOT LIKE '%S3%' OR storage_type NOT LIKE '%MINIO%')
|
|
|
|
|
AND (path IS NULL OR path NOT LIKE '%s3://%' OR path NOT LIKE '%minio%')
|
|
|
|
|
AND size > 0
|
|
|
|
|
ORDER BY create_time DESC
|
|
|
|
|
LIMIT #{limit}
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-01-18 19:05:51 +08:00
|
|
|
</mapper>
|