<?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.PointDisassembleConfigMapper">

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

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

    </insert>

    <insert id="insertOne" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
        insert into point_disassemble_config (point_id,value)
        values(#{pointId},#{value})
    </insert>

    <update id="updateById" parameterType="com.ho.business.entity.PointDisassembleConfig">
        update point_disassemble_config
        <set>
            <if test="value != null">value = #{value},</if>
        </set>
        where id = #{id}
    </update>

    <select id="selectByPointIds" resultType="com.ho.business.entity.PointDisassembleConfig">
        select <include refid="Base_Column_List"/>
        from point_disassemble_config
        <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>
    </select>

    <delete id="deleteByIds">
        delete
        from point_disassemble_config
        <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_disassemble_config
        <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>
