<?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.core.sys.dao.DwdShbDsFeederBaseMapper">

    <resultMap id="BaseResultMap" type="com.hdkj.lt.core.bizms.modle.po.DwdShbDsFeederBase">
            <id property="psrId" column="psr_id" jdbcType="VARCHAR"/>
            <id property="astId" column="ast_id" jdbcType="VARCHAR"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="voltageLevel" column="voltage_level" jdbcType="VARCHAR"/>
            <result property="voltageLevelName" column="voltage_level_name" jdbcType="VARCHAR"/>
            <result property="cableLength" column="cable_length" jdbcType="DECIMAL"/>
            <result property="cableMethod" column="cable_method" jdbcType="VARCHAR"/>
            <result property="cableMethodName" column="cable_method_name" jdbcType="VARCHAR"/>
            <result property="psrState" column="psr_state" jdbcType="VARCHAR"/>
            <result property="psrStateName" column="psr_state_name" jdbcType="VARCHAR"/>
            <result property="pubPrivFlag" column="pub_priv_flag" jdbcType="VARCHAR"/>
            <result property="pubPrivFlagName" column="pub_priv_flag_name" jdbcType="VARCHAR"/>
            <result property="referenceLength" column="reference_length" jdbcType="DECIMAL"/>
            <result property="runDevName" column="run_dev_name" jdbcType="VARCHAR"/>
            <result property="startBay" column="start_bay" jdbcType="VARCHAR"/>
            <result property="startStation" column="start_station" jdbcType="VARCHAR"/>
            <result property="startStationName" column="start_station_name" jdbcType="VARCHAR"/>
            <result property="startStationType" column="start_station_type" jdbcType="VARCHAR"/>
            <result property="startSwitch" column="start_switch" jdbcType="VARCHAR"/>
            <result property="startSwitchName" column="start_switch_name" jdbcType="VARCHAR"/>
            <result property="startSwitchType" column="start_switch_type" jdbcType="VARCHAR"/>
            <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
            <result property="supplyRadius" column="supply_radius" jdbcType="DECIMAL"/>
            <result property="supplyArea" column="supply_area" jdbcType="VARCHAR"/>
            <result property="supplyAreaName" column="supply_area_name" jdbcType="VARCHAR"/>
            <result property="regionalism" column="regionalism" jdbcType="VARCHAR"/>
            <result property="regionalismName" column="regionalism_name" jdbcType="VARCHAR"/>
            <result property="consNo" column="cons_no" jdbcType="VARCHAR"/>
            <result property="dispatchOrg" column="dispatch_org" jdbcType="VARCHAR"/>
            <result property="dispatchOrgName" column="dispatch_org_name" jdbcType="VARCHAR"/>
            <result property="dispatchLevel" column="dispatch_level" jdbcType="VARCHAR"/>
            <result property="dispatchLevelName" column="dispatch_level_name" jdbcType="VARCHAR"/>
            <result property="equipmentOwner" column="equipment_owner" jdbcType="VARCHAR"/>
            <result property="equipmentOwnerName" column="equipment_owner_name" jdbcType="VARCHAR"/>
            <result property="erectionMethod" column="erection_method" jdbcType="VARCHAR"/>
            <result property="erectionMethodName" column="erection_method_name" jdbcType="VARCHAR"/>
            <result property="feederRateCapacity" column="feeder_rate_capacity" jdbcType="DECIMAL"/>
            <result property="importance" column="importance" jdbcType="VARCHAR"/>
            <result property="importanceName" column="importance_name" jdbcType="VARCHAR"/>
            <result property="isCentralizedelechtg" column="is_centralizedelechtg" jdbcType="VARCHAR"/>
            <result property="isDaFeeder" column="is_da_feeder" jdbcType="VARCHAR"/>
            <result property="isDistributedelechtg" column="is_distributedelechtg" jdbcType="VARCHAR"/>
            <result property="isRural" column="is_rural" jdbcType="VARCHAR"/>
            <result property="isRuralName" column="is_rural_name" jdbcType="VARCHAR"/>
            <result property="length" column="length" jdbcType="DECIMAL"/>
            <result property="city" column="city" jdbcType="VARCHAR"/>
            <result property="cityName" column="city_name" jdbcType="VARCHAR"/>
            <result property="maintOrg" column="maint_org" jdbcType="VARCHAR"/>
            <result property="maintOrgName" column="maint_org_name" jdbcType="VARCHAR"/>
            <result property="maintGroup" column="maint_group" jdbcType="VARCHAR"/>
            <result property="maintGroupName" column="maint_group_name" jdbcType="VARCHAR"/>
            <result property="normalEnergizingBusbar" column="normal_energizing_busbar" jdbcType="VARCHAR"/>
            <result property="overheadLength" column="overhead_length" jdbcType="DECIMAL"/>
            <result property="overheadMethod" column="overhead_method" jdbcType="VARCHAR"/>
            <result property="overheadMethodName" column="overhead_method_name" jdbcType="VARCHAR"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="astNature" column="ast_nature" jdbcType="VARCHAR"/>
            <result property="astNatureName" column="ast_nature_name" jdbcType="VARCHAR"/>
            <result property="astOrg" column="ast_org" jdbcType="VARCHAR"/>
            <result property="astOrgName" column="ast_org_name" jdbcType="VARCHAR"/>
            <result property="deployState" column="deploy_state" jdbcType="VARCHAR"/>
            <result property="deployStateName" column="deploy_state_name" jdbcType="VARCHAR"/>
            <result property="equipCode" column="equip_code" jdbcType="VARCHAR"/>
            <result property="isCommission" column="is_commission" jdbcType="VARCHAR"/>
            <result property="isCommissionName" column="is_commission_name" jdbcType="VARCHAR"/>
            <result property="operateDate" column="operate_date" jdbcType="TIMESTAMP"/>
            <result property="source" column="source" jdbcType="VARCHAR"/>
            <result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
            <result property="ctime" column="ctime" jdbcType="TIMESTAMP"/>
            <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
            <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        psr_id,ast_id,name,
        voltage_level,voltage_level_name,cable_length,
        cable_method,cable_method_name,psr_state,
        psr_state_name,pub_priv_flag,pub_priv_flag_name,
        reference_length,run_dev_name,start_bay,
        start_station,start_station_name,start_station_type,
        start_switch,start_switch_name,start_switch_type,
        start_time,supply_radius,supply_area,
        supply_area_name,regionalism,regionalism_name,
        cons_no,dispatch_org,dispatch_org_name,
        dispatch_level,dispatch_level_name,equipment_owner,
        equipment_owner_name,erection_method,erection_method_name,
        feeder_rate_capacity,importance,importance_name,
        is_centralizedelechtg,is_da_feeder,is_distributedelechtg,
        is_rural,is_rural_name,length,
        city,city_name,maint_org,
        maint_org_name,maint_group,maint_group_name,
        normal_energizing_busbar,overhead_length,overhead_method,
        overhead_method_name,update_time,ast_nature,
        ast_nature_name,ast_org,ast_org_name,
        deploy_state,deploy_state_name,equip_code,
        is_commission,is_commission_name,operate_date,
        source,source_name,ctime,
        last_update_time,del_flag
    </sql>


    <select id="getFeederFile" resultType="com.hdkj.lt.core.sys.model.dto.FeederFileDTO">
        select d.psr_id psrId,
               d.name name,
               d.maint_org maintOrg,
               d.start_station startStation,
               d.start_station_name startStationName,
               f.id id,
               f.file_id fileId,
               f.file_type fileType
        from dwd_shb_ds_feeder_base d
                 left join fhzg_dist_mapping_file f on d.psr_id = f.line_id
        where  d.del_flag='0' and d.deploy_state='20' and d.pub_priv_flag = '0'
        order by d.psr_id
            limit #{limit} OFFSET #{offset}
    </select>

    <select id="getFeederFileById" resultType="com.hdkj.lt.core.sys.model.dto.FeederFileDTO">
        select d.psr_id psrId,
               d.name name,
               d.maint_org maintOrg,
               d.start_station startStation,
               d.start_station_name startStationName,
               f.id id,
               f.file_id fileId,
               f.file_type fileType
        from dwd_shb_ds_feeder_base d
        left join fhzg_dist_mapping_file f on d.psr_id = f.line_id
        where d.del_flag='0' and d.psr_id = #{feederId}
    </select>

    <select id="getFeederListByMaintOrg" resultType="com.hdkj.lt.core.bizms.modle.po.DwdShbDsFeederBase">
        select *
        from dwd_shb_ds_feeder_base
        where psr_state = '20'
          and pub_priv_flag = 0
          and maint_org = #{maintOrg}
    </select>


</mapper>
