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

    <select id="getTransferSchemeStrategyScoreByFaultId"
            resultType="com.hdkj.lt.bf.entity.dto.FhzgPlanTransferSchemeStrategyScoreDTO">
        SELECT
            sss.id id,
            ts.scheme_name schemeName,
            ts.scheme_state schemeState,
            ts.evaluation_score evaluationScore,
            sss.scheme_id schemeId,
            sss.strategy_id strategyId,
            sss.evaluation_index_id evaluationIndexId,
            sss.loss_users lossUsers,
            sss.transfer_load_ratio transferLoadRatio,
            sss.non_auto_switch_operation_times nonAutoSwitchOperationTimes,
            sss.opposite_line_max_load_rate oppositeLineMaxLoadRate,
            sss.distribution_transformer_voltage distributionTransformerVoltage,
            sss.switch_operation_times switchOperationTimes,
            sss.loss_power_secured_users lossPowerSecuredUsers
        FROM
            fhzg_fault_transfer_scheme ts
                LEFT JOIN fhzg_fault_transfer_scheme_strategy_score sss ON ts.id = sss.scheme_id
        WHERE
            ts.fault_id = #{faultId}
        order by ts.scheme_state,ts.evaluation_score desc
    </select>

</mapper>
