<?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.hdkj.lt.bf.mapper.FhzgPlanPowerCutMapper">


    <select id="queryHistListBatch" resultType="com.hdkj.lt.bf.entity.FhzgPlanPowerCut">

        select *
        from (select id,
        plan_no,
        plan_start_time,
        plan_end_time,
        plan_source,
        line_id,
        line_name,
        line_content,
        work_content,
        strategy_id,
        feeder_name,
        city_code,
        city_name,
        plan_state,
        scheme_state,
        power_on_success,
        creator,
        create_time,
        last_editor,
        last_time,
        is_delete,
        valid_flag,
        is_newest,
        county_code,
        county_name,
        ROW_NUMBER() over ( PARTITION by plan_no order by create_time desc ) as rn
        from fhzg_plan_power_cut
        where plan_no in
        <foreach collection="planNoList" open="(" item="item" separator="," close=")">
            #{item}
        </foreach>
        and (is_delete != '1' OR is_delete IS NULL)
        ) t
        where t.rn &lt;= 3
    </select>
    <select id="getPlanCreateTimeByPlanId" resultType="java.time.LocalDateTime">
        select create_time
        from fhzg_plan_await_transfer_area_result
        where plan_id = #{id}
    </select>
</mapper>
