<?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.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationEngineeringInfoMapper">
    <select id="getRealScaleByPeasantHouseholdNo" resultType="String">
       select
           hpsei.real_scale realScale
       from
           hygf_peasant_household hph,
           hygf_work_order_power_station hwops,
           hygf_power_station_engineering_info hpsei
       where
           hph.peasant_household_no = #{peasantHouseholdNo} and
           hph.sequence_nbr = hwops.peasant_household_id and
           hwops.sequence_nbr = hpsei.work_order_power_station_id
    </select>

    <select id="getRealScaleByPeasantHouseholdNoList" resultType="java.util.Map">
        select
        hph.peasant_household_no,hpsei.real_scale realScale
        from
        hygf_peasant_household hph
        left join hygf_work_order_power_station hwops on hph.sequence_nbr = hwops.peasant_household_id
        left join hygf_power_station_engineering_info hpsei on hwops.sequence_nbr = hpsei.work_order_power_station_id
        where
        hph.peasant_household_no in
        <foreach item="peasantHouseholdNo" collection="list" open="(" separator="," close=")">
            #{peasantHouseholdNo}
        </foreach>
    </select>

    <select id="getRealScaleByPeasantHouseholdNoIsHisotry" resultType="String">
        select
            hpsei.real_scale realScale
        from
            hygf_peasant_household hph,
            hygf_power_station_engineering_info hpsei
        where
            hph.peasant_household_no = #{peasantHouseholdNo} and
            hph.sequence_nbr = hpsei.work_order_power_station_id
    </select>
</mapper>
