<?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.pcloud.book.applet.dao.impl.AppletThirdResourcesRelationDaoImpl">
    <resultMap id="BaseResultMap" type="com.pcloud.book.applet.entity.AppletThirdResourcesRelation">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="third_resources_id" property="thirdResourcesId" jdbcType="BIGINT"/>
        <result column="from_id" property="fromId" jdbcType="BIGINT"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    </resultMap>

    <insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletThirdResourcesRelation" useGeneratedKeys="true"
            keyProperty="id">
    insert into applet_third_resources_relation ( third_resources_id,from_id,create_time)
    values (#{thirdResourcesId,jdbcType=BIGINT}, #{fromId,jdbcType=BIGINT},now())
  </insert>

    <!--批量插入-->
    <insert id="batchInsert"  parameterType="com.pcloud.book.applet.entity.AppletThirdResourcesRelation" useGeneratedKeys="true" keyProperty="id">
        insert into applet_third_resources_relation ( third_resources_id,from_id,create_time)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.thirdResourcesId,jdbcType=BIGINT}, #{item.fromId,jdbcType=BIGINT},now())
        </foreach>
    </insert>


    <delete id="deleteByAppletNewsId">
     delete from applet_third_resources_relation where from_id=#{id}
   </delete>




</mapper>