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

    <insert id="batchAlgSchemeWindowPass">
        insert into alg_scheme_window_pass(
        id,
        scheme_step_window_id,
        satellite_id,
        pass_num,
        start_time,
        end_time,
        total_time,
        station_id,
        station_name,
        station_code,
        pass_status,
        pass_type
        )
        values
        <foreach item="item" index="index" collection="list" separator=",">
            (
            #{item.id},
            #{item.schemeStepWindowId},
            #{item.satelliteId},
            #{item.passNum},
            #{item.startTime},
            #{item.endTime},
            #{item.totalTime},
            #{item.stationId},
            #{item.stationName},
            #{item.stationCode},
            #{item.passStatus},
            #{item.passType}
            )
        </foreach>
    </insert>

    <select id="selectAlgSchemeWindowPassListByWindowIds" resultType="com.base.plan.model.entity.AlgSchemeWindowPass">
        select * from alg_scheme_window_pass
        <where>
            <if test="windowIds != null and windowIds.size()>0 ">
                scheme_step_window_id in
                <foreach collection="windowIds" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>

            </if>
            <if test="null!=passType">
                and pass_type = #{passType}
            </if>
        </where>
    </select>

    <select id="selectSchemeWindowPassByWindowIds" resultType="com.base.plan.model.entity.AlgSchemeWindowPass">
        select
            aswp.id,
            aswp.scheme_step_window_id,
            aswp.pass_status,
            aswp.start_time,
            aswp.pass_type,
            aswp.end_time,
            aswp.station_id,
            aswp.station_name,
            aswp.station_code,
            aswp.pass_num,
            aswp.satellite_id,
            aswp.total_time
        from
            alg_scheme_window_pass aswp
        <where>
            aswp.scheme_step_window_id in
            <foreach collection="windowIds" item="windowId" open="(" separator="," close=")">
                #{windowId}
            </foreach>
        </where>
    </select>

</mapper>
