<?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.mapper.excelreport.GetFpyDataMapper">
    <select id="getFpy" resultType="java.util.HashMap">
        select phasic_type PHASETYPE,
        <choose>
            <when test="flag != 2">
                <foreach collection="list" item="item" separator="," close=",">
                    sum(UHarm_${item}_OverTime) UHarm_${item}_OverTime,sum(IHarm_${item}_OverTime)
                    IHarm_${item}_OverTime
                </foreach>
                sum(Voltage_Dev_OverTime) Voltage_Dev_OverTime,sum(UAberrance_OverTime)
                UAberrance_OverTime,sum(Flicker_OverTime) Flicker_OverTime,sum(AllTime) AllTime,sum(Flicket_AllTime) Flicket_AllTime from limit_rate
                where timeid between #{conditionData.start} and #{conditionData.end} and myindex = #{conditionData.pointIndex} and
                Phasic_Type in('A','B','C','T')
                <foreach collection="conditionData.exceptTime" index="index" item="item" open=" " separator=" " close="">
                    and timeid not between #{item.start} and #{item.end}
                </foreach>
            </when>
            <otherwise>
                sum(UBalance_OverTime) UBalance_OverTime,sum(Freq_Dev_OverTime) Freq_Dev_OverTime,sum(AllTime) AllTime
                from limit_rate where timeid between #{conditionData.start} and #{conditionData.end} and myindex =
                #{conditionData.pointIndex} and Phasic_Type = 'T'
                <foreach collection="conditionData.exceptTime" index="index" item="item" open=" " separator=" " close="">
                    and timeid not between #{item.start} and #{item.end}
                </foreach>
            </otherwise>
        </choose>
        group by phasic_type
    </select>
</mapper>