<?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.ho.business.mapper.PointConfigRelationMapper">

    <sql id="Base_Column_List">
        id,point_id,dynamic_config_id
    </sql>

    <insert id="insertList" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
        insert into point_config_relation (point_id,dynamic_config_id)
        values
        <foreach item="item" collection="list" index="index" separator=",">
            ( #{item.pointId},#{item.dynamicConfigId} )
        </foreach>
    </insert>

    <delete id="deleteByIds">
        delete
        from point_config_relation
        <where>
            <if test="ids != null and ids.size() != 0">
                and id in
                <foreach collection="ids" open="(" close=")" separator="," item="item">
                    #{item}
                </foreach>
            </if>
        </where>
    </delete>

    <delete id="deleteByPointIds">
        delete
        from point_config_relation
        <where>
            <if test="ids != null and ids.size() != 0">
                and point_id in
                <foreach collection="ids" open="(" close=")" separator="," item="item">
                    #{item}
                </foreach>
            </if>
        </where>
    </delete>
    
</mapper>
