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

    <select id="selectPowerCutSwitchList" resultType="com.hdkj.lt.core.bizms.modle.po.fault.FaultPowerCutSwitch"
    parameterType="com.hdkj.lt.core.bizms.modle.dto.SchemeQueryDTO">
        select
            a.id,
            a.fault_id,
            a.start_switch,
            a.end_switch,
            a.remark,
            a.status,
            a.is_full_line
        from fhzg_fault_power_cut_switch a
       where a.fault_id = #{faultId}
    </select>

    <select id="selectSwitchSectionList" resultType="com.hdkj.lt.core.bizms.modle.po.fault.FaultAwaitTransferSwitchSection">
        select
            a.id,
            a.fault_id,
            a.switch_name,
            a.start_switch_id,
            a.start_switch_name,
            a.start_switch_type,
            a.end_switch_id,
            a.end_switch_name
        from fhzg_fault_await_transfer_switch_section a
        where a.fault_id = #{faultId}
    </select>

    <select id="selectFhzgPlanById" resultType="com.hdkj.lt.core.bizms.modle.po.fault.FaultPowerCut">
        select
            a.id,
            a.line_id,
            a.line_name,
            a.strategy_id,
            a.feeder_name,
            a.feeder_list_json,
            a.city_code,
            a.city_name,
            a.scheme_state
        from fhzg_fault_power_cut a
        where a.id = #{faultId}
    </select>

    <select id="selectSchemePathDetailByFault" resultType="com.hdkj.lt.core.bizms.modle.po.fault.FaultTransferSchemePathDetail">
        select a.* from fhzg_fault_transfer_scheme_path_detail a, fhzg_fault_transfer_scheme b
        where a.scheme_id = b.id
          and b.fault_id = #{faultId}
    </select>

    <select id="selectSwitchByCustomerId" resultType="java.lang.String">
        SELECT d.show_switch_id load_switch_id
        from fhzg_fault_power_cut_pv_users a join fhzg_dist_pv_customer b on a.cust_id=b.cust_id
        join t_feeder_topo c on b.transformer_no = c.psr_id
        join fhzg_dist_line_switch_section_show d on c.start_kg_id=d.psr_id and d.obj_id=c.feeder
        where a.cust_id = #{customerId}
        GROUP BY show_switch_id;
    </select>

</mapper>
