<?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.njcn.harmonic.mapper.RMpMeasurePhaseReportDMapper">

    <resultMap id="BaseResultMap" type="com.njcn.harmonic.pojo.po.RMpMeasurePhaseReportD">
            <id property="measurementPointId" column="measurement_point_id" jdbcType="VARCHAR"/>
            <id property="dataDate" column="data_date" jdbcType="DATE"/>
            <id property="phase" column="phase" jdbcType="VARCHAR"/>
            <result property="phaseVoltageEffectiveMax" column="phase_voltage_effective_max" jdbcType="FLOAT"/>
            <result property="phaseVoltageEffectiveMin" column="phase_voltage_effective_min" jdbcType="FLOAT"/>
            <result property="phaseVoltageEffectiveAvg" column="phase_voltage_effective_avg" jdbcType="FLOAT"/>
            <result property="phaseVoltageEffective95" column="phase_voltage_effective_95" jdbcType="FLOAT"/>
            <result property="lineVoltageEffectiveMax" column="line_voltage_effective_max" jdbcType="FLOAT"/>
            <result property="lineVoltageEffectiveMin" column="line_voltage_effective_min" jdbcType="FLOAT"/>
            <result property="lineVoltageEffectiveAvg" column="line_voltage_effective_avg" jdbcType="FLOAT"/>
            <result property="lineVoltageEffective95" column="line_voltage_effective_95" jdbcType="FLOAT"/>
            <result property="vDeUpMax" column="v_de_up_max" jdbcType="FLOAT"/>
            <result property="vDeUpMin" column="v_de_up_min" jdbcType="FLOAT"/>
            <result property="vDeUpAvg" column="v_de_up_avg" jdbcType="FLOAT"/>
            <result property="vDeUp95" column="v_de_up_95" jdbcType="FLOAT"/>
            <result property="vDeLowMax" column="v_de_low_max" jdbcType="FLOAT"/>
            <result property="vDeLowMin" column="v_de_low_min" jdbcType="FLOAT"/>
            <result property="vDeLowAvg" column="v_de_low_avg" jdbcType="FLOAT"/>
            <result property="vDeLow95" column="v_de_low_95" jdbcType="FLOAT"/>
            <result property="currentEffectiveMax" column="current_effective_max" jdbcType="FLOAT"/>
            <result property="currentEffectiveMin" column="current_effective_min" jdbcType="FLOAT"/>
            <result property="currentEffectiveAvg" column="current_effective_avg" jdbcType="FLOAT"/>
            <result property="currentEffective95" column="current_effective_95" jdbcType="FLOAT"/>
            <result property="spActivePowerMax" column="sp_active_power_max" jdbcType="FLOAT"/>
            <result property="spActivePowerMin" column="sp_active_power_min" jdbcType="FLOAT"/>
            <result property="spActivePowerAvg" column="sp_active_power_avg" jdbcType="FLOAT"/>
            <result property="spActivePower95" column="sp_active_power_95" jdbcType="FLOAT"/>
            <result property="spReactivePowerMax" column="sp_reactive_power_max" jdbcType="FLOAT"/>
            <result property="spReactivePowerMin" column="sp_reactive_power_min" jdbcType="FLOAT"/>
            <result property="spReactivePowerAvg" column="sp_reactive_power_avg" jdbcType="FLOAT"/>
            <result property="spReactivePower95" column="sp_reactive_power_95" jdbcType="FLOAT"/>
            <result property="spApparentPowerMax" column="sp_apparent_power_max" jdbcType="FLOAT"/>
            <result property="spApparentPowerMin" column="sp_apparent_power_min" jdbcType="FLOAT"/>
            <result property="spApparentPowerAvg" column="sp_apparent_power_avg" jdbcType="FLOAT"/>
            <result property="spApparentPower95" column="sp_apparent_power_95" jdbcType="FLOAT"/>
            <result property="spPowerFactorMax" column="sp_power_factor_max" jdbcType="FLOAT"/>
            <result property="spPowerFactorMin" column="sp_power_factor_min" jdbcType="FLOAT"/>
            <result property="spPowerFactorAvg" column="sp_power_factor_avg" jdbcType="FLOAT"/>
            <result property="spPowerFactor95" column="sp_power_factor_95" jdbcType="FLOAT"/>
            <result property="spFundamentalPowerFactorMax" column="sp_fundamental_power_factor_max" jdbcType="FLOAT"/>
            <result property="spFundamentalPowerFactorMin" column="sp_fundamental_power_factor_min" jdbcType="FLOAT"/>
            <result property="spFundamentalPowerFactorAvg" column="sp_fundamental_power_factor_avg" jdbcType="FLOAT"/>
            <result property="spFundamentalPowerFactor95" column="sp_fundamental_power_factor_95" jdbcType="FLOAT"/>
    </resultMap>

    <sql id="Base_Column_List">
        measurement_point_id,data_date,phase,
        phase_voltage_effective_max,phase_voltage_effective_min,phase_voltage_effective_avg,
        phase_voltage_effective_95,line_voltage_effective_max,line_voltage_effective_min,
        line_voltage_effective_avg,line_voltage_effective_95,v_de_up_max,
        v_de_up_min,v_de_up_avg,v_de_up_95,
        v_de_low_max,v_de_low_min,v_de_low_avg,
        v_de_low_95,current_effective_max,current_effective_min,
        current_effective_avg,current_effective_95,sp_active_power_max,
        sp_active_power_min,sp_active_power_avg,sp_active_power_95,
        sp_reactive_power_max,sp_reactive_power_min,sp_reactive_power_avg,
        sp_reactive_power_95,sp_apparent_power_max,sp_apparent_power_min,
        sp_apparent_power_avg,sp_apparent_power_95,sp_power_factor_max,
        sp_power_factor_min,sp_power_factor_avg,sp_power_factor_95,
        sp_fundamental_power_factor_max,sp_fundamental_power_factor_min,sp_fundamental_power_factor_avg,
        sp_fundamental_power_factor_95
    </sql>
    <select id="getListByCond" resultType="com.njcn.harmonic.pojo.po.RMpMeasurePhaseReportD" parameterType="java.util.Map">
        select <include refid="Base_Column_List"/>
        from r_mp_measure_phase_report_d
        where 1 = 1
        <if test="startTime != null and startTime != ''">
            AND DATE_FORMAT(data_date, '%Y-%m-%d') >=  #{startTime, jdbcType=VARCHAR}
        </if>
        <if test="endTime != null and endTime != ''">
            AND DATE_FORMAT(data_date, '%Y-%m-%d') &lt;=  #{endTime, jdbcType=VARCHAR}
        </if>
        and measurement_point_id IN
        <foreach collection="monitorIdList" open="(" close=")" separator="," item="id">
            #{id}
        </foreach>
    </select>
</mapper>
