Files
gofly-platform-services/zlt-business/file-center/src/main/resources/mapper/FileMapper.xml
T

56 lines
2.1 KiB
XML

<?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 &gt;= #{f.beginTime}
</if>
<if test="f.endTime != null and f.endTime != ''">
and t.create_time &lt;= #{f.endTime}
</if>
<if test="f.searchKey != null and f.searchKey != ''">
and t.name like concat('%', #{f.searchKey}, '%')
</if>
</where>
</sql>
<select id="findList" resultType="com.central.common.model.FileInfo">
select * from file_info t
<include refid= "where" />
order by t.create_time desc
</select>
<select id="findById" resultType="com.central.common.model.FileInfo">
SELECT * FROM file_info WHERE id = #{id}
</select>
<!-- 查询文件列表 -->
<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>
<!-- 热数据同步相关查询已移除(外部同步) -->
</mapper>