<?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="cn.cslg.report.mapper.AssoProductFileMapper">

    <!--批量插入产品文件关联表数据-->
    <!--int insertBatch(List<AssoProductFile> assoProductFiles);-->
    <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
        insert into ASSO_PRODUCT_FILE (PRODUCT_ID, FILE_ID, FILE_USE_TYPE)
        values
        <foreach collection="list" item="n" separator=",">
            (#{n.productId}, #{n.fileId}, #{n.fileUseType})
        </foreach>
    </insert>

    <!--根据附件fileId批量删除产品文件关联表数据-->
    <!--int deleteByFileIds(List<Integer> fileIds);-->
    <delete id="deleteByFileIds">
        delete
        from ASSO_PRODUCT_FILE
        where FILE_ID in (
        <foreach collection="list" item="n" separator=",">
            #{n}
        </foreach>
        )
    </delete>

    <!--根据产品reportId删除产品文件关联表数据-->
    <!--int deleteByProductId(Integer productId);-->
    <delete id="deleteByProductId">
        delete
        from ASSO_PRODUCT_FILE
        where PRODUCT_ID = #{productId}
    </delete>

</mapper>