<?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.base.plan.mapper.StepWindowControlPassRelationMapper">

    <update id="initSelected">
        <bind name="parentId" value="parentId + '%'" />
        update
            step_window_control_pass_relation swcpr
        set
            swcpr.is_confirm = '1'
        <where>
            swcpr.window_id in (
            select
            assw.id from alg_scheme_step_window  assw
            where assw.parent_id like #{parentId}
            )
            and
            swcpr.is_confirm = '2'
        </where>
    </update>
    <update id="initSelectedByList">
        update
            step_window_control_pass_relation swcpr
        set
            swcpr.is_confirm = '1'
        <where>
            swcpr.window_id in (
            select
                assw.id from alg_scheme_step_window  assw
            where assw.parent_id in
                <foreach collection="parentIds" item="parentId" open="(" separator="," close=")">
                    #{parentId}
                </foreach>
            )
            and
            swcpr.is_confirm = '2'
        </where>
    </update>
    <update id="batchUpdateConfirmStatus">
        update
            step_window_control_pass_relation swcpr
        set
            swcpr.is_confirm = '2'
        <where>
            swcpr.control_station_window_id in
            <foreach collection="controlWindowIds" item="controlWindowId"  open="(" separator="," close=")">
                #{controlWindowId}
            </foreach>
        </where>
    </update>
</mapper>