<?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.OssFileMapper">

    <select id="list" resultType="com.yd.oss.feign.response.ApiOssFileListResponse">
        select o.*,
        concat('https://', op.bucket_name, '.', op.endpoint, '/', o.file_key) as fileUrl
        from oss_file o
        left join oss_provider op on op.provider_biz_id = o.provider_biz_id and op.is_deleted = 0
        <where>
            <if test="objectBizId != null and objectBizId != ''">
                and o.object_biz_id = #{objectBizId}
            </if>
            <if test="objectBizIdList != null and objectBizIdList.size > 0">
                and o.object_biz_id in
                <foreach collection="objectBizIdList" item="item" index="index" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            and o.is_deleted = 0
        </where>
    </select>
</mapper>
