<?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.com.countrygarden.bi.main.dao.mediaResource.AdvertisingFileDirectoryMapper">

	<update id="saveRelation">
		update advertising_file_directory set media_id = #{mediaId} where id in
		<foreach collection="fileIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
	</update>


	<insert id="insertCallBack" parameterType="cn.com.countrygarden.bi.main.model.mediaResource.AdvertisingFileDirectory">
		<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
          	SELECT LAST_INSERT_ID()
      	</selectKey>
		insert into advertising_file_directory(file_name,file_real_name,file_url,media_id)
		values(#{fileName},#{fileRealName},#{fileUrl},#{mediaId})
	</insert>
</mapper>