<?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.yd.oss.service.dao.FileTemplateMapper">

    <select id="getFileProd" resultType="com.yd.oss.service.dto.FileProdDto">
        select * from
        file_template f
        left join oss_file o on o.file_biz_id = f.file_biz_id and o.is_deleted = 0
        left join oss_provider p on p.provider_biz_id = o.provider_biz_id and p.is_deleted = 0

        <where>
            <if test="templateName != null and templateName != ''">
                and f.template_name = #{templateName}
            </if>

            <if test="templateType != null and templateType != ''">
                and f.template_type = #{templateType}
            </if>

            and f.is_deleted = 0
        </where>

        limit 1
    </select>
</mapper>
