<?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.ytpm.middle.dao.AttachMapper">

    <select id="queryByTargetId" resultType="com.ytpm.middle.view.AttachVO">
        select
            attach_id, attach_name, url, size, target_type, target_id, upload_time, upload_user_id
        from yt_platform_attach
        where target_type = #{targetType} and target_id = #{targetId}
    </select>

    <insert id="batchInsert">
        insert into yt_platform_attach
        (
        attach_id,
        attach_name,
        url,
        size,
        target_type,
        target_id,
        upload_time,
        upload_user_id
        )
        values
        <foreach collection="dataList" separator="," item="item">
            (
            #{item.attachId},
            #{item.attachName},
            #{item.url},
            #{item.size},
            #{item.targetType},
            #{item.targetId},
            #{item.uploadTime},
            #{item.uploadUserId}
            )
        </foreach>

    </insert>
</mapper>