<?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.fs.file.mapper.SysFileMapper">

    <select id="selectByBiz" resultType="com.fs.file.domain.SysUploadFile">
        SELECT * FROM sys_file
        WHERE tenant_id = #{tenantId}
          AND biz_type = #{bizType}
          AND biz_id = #{bizId}
          AND is_deleted = 0
        ORDER BY sort_order ASC, create_time DESC
    </select>

    <select id="selectByMd5" resultType="com.fs.file.domain.SysUploadFile">
        SELECT * FROM sys_file
        WHERE tenant_id = #{tenantId}
          AND file_md5 = #{md5}
          AND is_deleted = 0
            LIMIT 1
    </select>

</mapper>
