<?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.csharmonic.mapper.RStatLimitRateDMapper">

    <select id="getSumPassRate" resultType="com.njcn.csharmonic.pojo.vo.RStatLimitRateDVO">
        SELECT
            SUM( all_time ) AS alltime,
            SUM( freq_dev_overtime ) AS frequency,
            SUM( ubalance_overtime ) AS uBalance,
            SUM( i_neg_overtime ) AS iNeg,
            SUM( iharm_13_overtime ) AS harmElec,
            SUM( uharm_4_overtime ) AS harmVoltage,
            SUM( flicker_overtime ) AS flicker,
            SUM( flicker_all_time ) AS allFlicker,
            SUM( voltage_dev_overtime ) AS voltageDeviation,
            SUM( inuharm_9_overtime ) AS inUharm
        FROM
            r_stat_limit_rate_d
        <where>
            <if test=" ids != null and ids.size > 0">
                AND my_index IN
                <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
            <if test=" statTime != null and statTime !=''">
                AND  time_id >= #{statTime}
            </if>
            <if test="endTime != null and endTime != ''">
                AND  time_id &lt;= #{endTime}
            </if>
        </where>
    </select>
    <select id="getSumLimitRateByLineIndexes" resultType="com.njcn.csharmonic.pojo.vo.MonitorOverLimitVO">
        SELECT
        my_index AS id,
        SUM(all_time) AS overDay,
        SUM(freq_dev_overtime) AS freqOverDay,
        SUM(voltage_dev_overtime ) AS volDevOverDay,
        SUM(flicker_overtime) AS flickerOverDay,
        SUM(i_neg_overtime) AS negativeOverDay,
        SUM(ubalance_overtime) AS threeUnbalance,
        SUM(uaberrance_overtime) AS volDisOverDay,
        SUM(uharm_3_overtime) AS overVolThreeTimes,
        SUM(uharm_5_overtime) AS overVolFiveTimes,
        SUM(uharm_7_overtime) AS overVolSevenTimes,
        SUM(uharm_11_overtime) AS overVolElevenTimes,
        SUM(uharm_13_overtime) AS overVolThirteenTimes,
        SUM(uharm_23_overtime) AS overVolTwentyThreeTimes,
        SUM(uharm_25_overtime) AS overVolTwentyFiveTimes,
        SUM(uharm_2_overtime)
        + SUM(uharm_4_overtime)
        + SUM(uharm_6_overtime)
        + SUM(uharm_8_overtime)
        + SUM(uharm_9_overtime)
        + SUM(uharm_10_overtime)
        + SUM(uharm_12_overtime)
        + SUM(uharm_14_overtime)
        + SUM(uharm_15_overtime)
        + SUM(uharm_16_overtime)
        + SUM(uharm_17_overtime)
        + SUM(uharm_18_overtime)
        + SUM(uharm_19_overtime)
        + SUM(uharm_20_overtime)
        + SUM(uharm_21_overtime)
        + SUM(uharm_22_overtime)
        + SUM(uharm_24_overtime) AS overVolOtherTimes,
        SUM(iharm_3_overtime) AS overCurThreeTimes,
        SUM(iharm_5_overtime) AS overCurFiveTimes,
        SUM(iharm_7_overtime) AS overCurSevenTimes,
        SUM(iharm_11_overtime) AS overCurElevenTimes,
        SUM(iharm_13_overtime) AS overCurThirteenTimes,
        SUM(iharm_23_overtime) AS overCurTwentyThreeTimes,
        SUM(iharm_25_overtime) AS overCurTwentyFiveTimes,
        SUM(iharm_2_overtime)
        + SUM(iharm_4_overtime)
        + SUM(iharm_6_overtime)
        + SUM(iharm_8_overtime)
        + SUM(iharm_9_overtime)
        + SUM(iharm_10_overtime)
        + SUM(iharm_12_overtime)
        + SUM(iharm_14_overtime)
        + SUM(iharm_15_overtime)
        + SUM(iharm_16_overtime)
        + SUM(iharm_17_overtime)
        + SUM(iharm_18_overtime)
        + SUM(iharm_19_overtime)
        + SUM(iharm_20_overtime)
        + SUM(iharm_21_overtime)
        + SUM(iharm_22_overtime)
        + SUM(iharm_24_overtime) AS overCurOtherTimes
        FROM
        r_stat_limit_rate_d
        <where>
            <if test=" ids != null and ids.size > 0">
                AND my_index IN
                <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
            <if test=" statTime != null and statTime !=''">
                AND  time_id >= #{statTime}
            </if>
            <if test="endTime != null and endTime != ''">
                AND  time_id &lt;= #{endTime}
            </if>
        </where>
        GROUP BY my_index
    </select>
    <select id="getSumLimitRatePage" resultType="com.njcn.csharmonic.pojo.vo.MonitorOverLimitVO">
        SELECT
        my_index AS id,
        SUM(all_time) AS overDay,
        SUM(freq_dev_overtime) AS freqOverDay,
        SUM(voltage_dev_overtime ) AS volDevOverDay,
        SUM(flicker_overtime) AS flickerOverDay,
        SUM(i_neg_overtime) AS negativeOverDay,
        SUM(ubalance_overtime) AS threeUnbalance,
        SUM(uaberrance_overtime) AS volDisOverDay,
        SUM(uharm_3_overtime) AS overVolThreeTimes,
        SUM(uharm_5_overtime) AS overVolFiveTimes,
        SUM(uharm_7_overtime) AS overVolSevenTimes,
        SUM(uharm_11_overtime) AS overVolElevenTimes,
        SUM(uharm_13_overtime) AS overVolThirteenTimes,
        SUM(uharm_23_overtime) AS overVolTwentyThreeTimes,
        SUM(uharm_25_overtime) AS overVolTwentyFiveTimes,
        SUM(uharm_2_overtime)
        + SUM(uharm_4_overtime)
        + SUM(uharm_6_overtime)
        + SUM(uharm_8_overtime)
        + SUM(uharm_9_overtime)
        + SUM(uharm_10_overtime)
        + SUM(uharm_12_overtime)
        + SUM(uharm_14_overtime)
        + SUM(uharm_15_overtime)
        + SUM(uharm_16_overtime)
        + SUM(uharm_17_overtime)
        + SUM(uharm_18_overtime)
        + SUM(uharm_19_overtime)
        + SUM(uharm_20_overtime)
        + SUM(uharm_21_overtime)
        + SUM(uharm_22_overtime)
        + SUM(uharm_24_overtime) AS overVolOtherTimes,
        SUM(iharm_3_overtime) AS overCurThreeTimes,
        SUM(iharm_5_overtime) AS overCurFiveTimes,
        SUM(iharm_7_overtime) AS overCurSevenTimes,
        SUM(iharm_11_overtime) AS overCurElevenTimes,
        SUM(iharm_13_overtime) AS overCurThirteenTimes,
        SUM(iharm_23_overtime) AS overCurTwentyThreeTimes,
        SUM(iharm_25_overtime) AS overCurTwentyFiveTimes,
        SUM(iharm_2_overtime)
        + SUM(iharm_4_overtime)
        + SUM(iharm_6_overtime)
        + SUM(iharm_8_overtime)
        + SUM(iharm_9_overtime)
        + SUM(iharm_10_overtime)
        + SUM(iharm_12_overtime)
        + SUM(iharm_14_overtime)
        + SUM(iharm_15_overtime)
        + SUM(iharm_16_overtime)
        + SUM(iharm_17_overtime)
        + SUM(iharm_18_overtime)
        + SUM(iharm_19_overtime)
        + SUM(iharm_20_overtime)
        + SUM(iharm_21_overtime)
        + SUM(iharm_22_overtime)
        + SUM(iharm_24_overtime) AS overCurOtherTimes
        FROM
        r_stat_limit_target_d
        <where>
            <if test=" ids != null and ids.size > 0">
                AND my_index IN
                <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
            <if test=" statTime != null and statTime !=''">
                AND  time_id >= #{statTime}
            </if>
            <if test="endTime != null and endTime != ''">
                AND  time_id &lt;= #{endTime}
            </if>
        </where>
        GROUP BY my_index
    </select>

    <select id="getPercentages" resultType="com.njcn.csharmonic.pojo.vo.MonitorOverLimitVO$DataVO">
            SELECT
            <choose>
                <when test="_databaseId == 'mysql'">
                    DATE_FORMAT(time_id, '%Y-%m-%d')
                </when>
                <otherwise>
                    TO_CHAR(time_id, 'YYYY-MM-DD')
                </otherwise>
            </choose> AS time,
            <choose>
                <when test="_databaseId == 'mysql'">
                    IFNULL(ROUND(
                </when>
                <otherwise>
                    NVL(TRUNC(
                </otherwise>
            </choose>
            CASE
            WHEN SUM(all_time) = 0 THEN 0
            ELSE (1 - (
            -- 各类指标求和（保持原有逻辑不变）
            SUM(flicker_overtime) + SUM(flicker_all_time) + SUM(freq_dev_overtime) +
            SUM(voltage_dev_overtime) + SUM(ubalance_overtime) + SUM(uaberrance_overtime) +
            SUM(i_neg_overtime) +
            -- 电压谐波 (2-25)
            SUM(uharm_2_overtime) + SUM(uharm_3_overtime) + SUM(uharm_4_overtime) + SUM(uharm_5_overtime) +
            SUM(uharm_6_overtime) + SUM(uharm_7_overtime) + SUM(uharm_8_overtime) + SUM(uharm_9_overtime) +
            SUM(uharm_10_overtime) + SUM(uharm_11_overtime) + SUM(uharm_12_overtime) + SUM(uharm_13_overtime) +
            SUM(uharm_14_overtime) + SUM(uharm_15_overtime) + SUM(uharm_16_overtime) + SUM(uharm_17_overtime) +
            SUM(uharm_18_overtime) + SUM(uharm_19_overtime) + SUM(uharm_20_overtime) + SUM(uharm_21_overtime) +
            SUM(uharm_22_overtime) + SUM(uharm_23_overtime) + SUM(uharm_24_overtime) + SUM(uharm_25_overtime) +
            -- 电流谐波 (2-25)
            SUM(iharm_2_overtime) + SUM(iharm_3_overtime) + SUM(iharm_4_overtime) + SUM(iharm_5_overtime) +
            SUM(iharm_6_overtime) + SUM(iharm_7_overtime) + SUM(iharm_8_overtime) + SUM(iharm_9_overtime) +
            SUM(iharm_10_overtime) + SUM(iharm_11_overtime) + SUM(iharm_12_overtime) + SUM(iharm_13_overtime) +
            SUM(iharm_14_overtime) + SUM(iharm_15_overtime) + SUM(iharm_16_overtime) + SUM(iharm_17_overtime) +
            SUM(iharm_18_overtime) + SUM(iharm_19_overtime) + SUM(iharm_20_overtime) + SUM(iharm_21_overtime) +
            SUM(iharm_22_overtime) + SUM(iharm_23_overtime) + SUM(iharm_24_overtime) + SUM(iharm_25_overtime) +
            -- 间谐波 (1-16)
            SUM(inuharm_1_overtime) + SUM(inuharm_2_overtime) + SUM(inuharm_3_overtime) + SUM(inuharm_4_overtime) +
            SUM(inuharm_5_overtime) + SUM(inuharm_6_overtime) + SUM(inuharm_7_overtime) + SUM(inuharm_8_overtime) +
            SUM(inuharm_9_overtime) + SUM(inuharm_10_overtime) + SUM(inuharm_11_overtime) + SUM(inuharm_12_overtime) +
            SUM(inuharm_13_overtime) + SUM(inuharm_14_overtime) + SUM(inuharm_15_overtime) + SUM(inuharm_16_overtime)
            ) / NULLIF(SUM(all_time) * 71, 0)) * 100
            END, 2), 0) AS data
            FROM
            r_stat_limit_rate_d
            <where>
                phasic_type = 'T'
                <if test="ids != null and ids.size > 0">
                    AND my_index IN
                    <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
                        #{item}
                    </foreach>
                </if>
                <if test="statTime != null and statTime != ''">
                    AND time_id >= #{statTime}
                </if>
                <if test="endTime != null and endTime != ''">
                    AND time_id &lt;= #{endTime}
                </if>
            </where>
            GROUP BY
            <choose>
                <when test="_databaseId == 'mysql'">
                    DATE_FORMAT(time_id, '%Y-%m-%d')
                </when>
                <otherwise>
                    TO_CHAR(time_id, 'YYYY-MM-DD')
                </otherwise>
            </choose>
            ORDER BY time
    </select>


    <select id="getSumPassRateList" resultType="com.njcn.csharmonic.pojo.po.RStatLimitRateDPO">
        SELECT
        my_index as lineId ,
        sum(all_time) as all_time,
        sum(flicker_all_time) as flicker_all_time,
        sum(freq_dev_overtime) as freq_dev_overtime,
        sum(voltage_dev_overtime) as voltage_dev_overtime,
        sum(ubalance_overtime) as ubalance_overtime,
        sum(flicker_overtime) as flicker_overtime,
        sum(uaberrance_overtime) as uaberrance_overtime,
        sum(uharm_2_overtime) as uharm_2_overtime,
        sum(uharm_3_overtime) as uharm_3_overtime,
        sum(uharm_4_overtime) as uharm_4_overtime,
        sum(uharm_5_overtime) as uharm_5_overtime,
        sum(uharm_6_overtime) as uharm_6_overtime,
        sum(uharm_7_overtime) as uharm_7_overtime,
        sum(uharm_8_overtime) as uharm_8_overtime,
        sum(uharm_9_overtime) as uharm_9_overtime,
        sum(uharm_10_overtime) as uharm_10_overtime,
        sum(uharm_11_overtime) as uharm_11_overtime,
        sum(uharm_12_overtime) as uharm_12_overtime,
        sum(uharm_13_overtime) as uharm_13_overtime,
        sum(uharm_14_overtime) as uharm_14_overtime,
        sum(uharm_15_overtime) as uharm_15_overtime,
        sum(uharm_16_overtime) as uharm_16_overtime,
        sum(uharm_17_overtime) as uharm_17_overtime,
        sum(uharm_18_overtime) as uharm_18_overtime,
        sum(uharm_19_overtime) as uharm_19_overtime,
        sum(uharm_20_overtime) as uharm_20_overtime,
        sum(uharm_21_overtime) as uharm_21_overtime,
        sum(uharm_22_overtime) as uharm_22_overtime,
        sum(uharm_23_overtime) as uharm_23_overtime,
        sum(uharm_24_overtime) as uharm_24_overtime,
        sum(uharm_25_overtime) as uharm_25_overtime,
        sum(iharm_2_overtime) as iharm_2_overtime,
        sum(iharm_3_overtime) as iharm_3_overtime,
        sum(iharm_4_overtime) as iharm_4_overtime,
        sum(iharm_5_overtime) as iharm_5_overtime,
        sum(iharm_6_overtime) as iharm_6_overtime,
        sum(iharm_7_overtime) as iharm_7_overtime,
        sum(iharm_8_overtime) as iharm_8_overtime,
        sum(iharm_9_overtime) as iharm_9_overtime,
        sum(iharm_10_overtime) as iharm_10_overtime,
        sum(iharm_11_overtime) as iharm_11_overtime,
        sum(iharm_12_overtime) as iharm_12_overtime,
        sum(iharm_13_overtime) as iharm_13_overtime,
        sum(iharm_14_overtime) as iharm_14_overtime,
        sum(iharm_15_overtime) as iharm_15_overtime,
        sum(iharm_16_overtime) as iharm_16_overtime,
        sum(iharm_17_overtime) as iharm_17_overtime,
        sum(iharm_18_overtime) as iharm_18_overtime,
        sum(iharm_19_overtime) as iharm_19_overtime,
        sum(iharm_20_overtime) as iharm_20_overtime,
        sum(iharm_21_overtime) as iharm_21_overtime,
        sum(iharm_22_overtime) as iharm_22_overtime,
        sum(iharm_23_overtime) as iharm_23_overtime,
        sum(iharm_24_overtime) as iharm_24_overtime,
        sum(iharm_25_overtime) as iharm_25_overtime,
        sum(inuharm_1_overtime) as inuharm_1_overtime,
        sum(inuharm_2_overtime) as inuharm_2_overtime,
        sum(inuharm_3_overtime) as inuharm_3_overtime,
        sum(inuharm_4_overtime) as inuharm_4_overtime,
        sum(inuharm_5_overtime) as inuharm_5_overtime,
        sum(inuharm_6_overtime) as inuharm_6_overtime,
        sum(inuharm_7_overtime) as inuharm_7_overtime,
        sum(inuharm_8_overtime) as inuharm_8_overtime,
        sum(inuharm_9_overtime) as inuharm_9_overtime,
        sum(inuharm_10_overtime) as inuharm_10_overtime,
        sum(inuharm_11_overtime) as inuharm_11_overtime,
        sum(inuharm_12_overtime) as inuharm_12_overtime,
        sum(inuharm_13_overtime) as inuharm_13_overtime,
        sum(inuharm_14_overtime) as inuharm_14_overtime,
        sum(inuharm_15_overtime) as inuharm_15_overtime,
        sum(inuharm_16_overtime) as inuharm_16_overtime,
        sum(i_neg_overtime) as i_neg_overtime
        from
            r_stat_limit_rate_d
        <where>
            phasic_type = 'T'
            <if test=" ids != null and ids.size > 0">
                AND my_index IN
                <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
            <if test=" statTime != null and statTime !=''">
                AND  time_id >= #{statTime}
            </if>
            <if test="endTime != null and endTime != ''">
                AND  time_id &lt;= #{endTime}
            </if>
        </where>
        GROUP BY
            my_index
    </select>

    <select id="getAssessTargetRate" resultType="com.njcn.csharmonic.pojo.po.RStatLimitRateDPO">
        select
            my_index as lineId,
            SUM(all_time) as allTime,
            SUM(flicker_all_time) as flickerAllTime,
            SUM(freq_dev_overtime) as freqDevOvertime,
            SUM(voltage_dev_overtime) as voltageDevOvertime,
            SUM(flicker_overtime) as flickerOvertime,
            SUM(ubalance_overtime) as ubalanceOvertime,
            SUM(uaberrance_overtime) as uaberranceOvertime,
            sum(uharm_2_overtime)  uharm2Overtime,
            sum(uharm_3_overtime)  uharm3Overtime,
            sum(uharm_4_overtime)  uharm4Overtime,
            sum(uharm_5_overtime)  uharm5Overtime,
            sum(uharm_6_overtime)  uharm6Overtime,
            sum(uharm_7_overtime)  uharm7Overtime,
            sum(uharm_8_overtime)  uharm8Overtime,
            sum(uharm_9_overtime)  uharm9Overtime,
            sum(uharm_10_overtime)  uharm10Overtime,
            sum(uharm_11_overtime)  uharm11Overtime,
            sum(uharm_12_overtime)  uharm12Overtime,
            sum(uharm_13_overtime)  uharm13Overtime,
            sum(uharm_14_overtime)  uharm14Overtime,
            sum(uharm_15_overtime)  uharm15Overtime,
            sum(uharm_16_overtime)  uharm16Overtime,
            sum(uharm_17_overtime)  uharm17Overtime,
            sum(uharm_18_overtime)  uharm18Overtime,
            sum(uharm_19_overtime)  uharm19Overtime,
            sum(uharm_20_overtime)  uharm20Overtime,
            sum(uharm_21_overtime)  uharm21Overtime,
            sum(uharm_22_overtime)  uharm22Overtime,
            sum(uharm_23_overtime)  uharm23Overtime,
            sum(uharm_24_overtime)  uharm24Overtime,
            sum(uharm_25_overtime)  uharm25Overtime,
            sum(iharm_2_overtime)  iharm2Overtime,
            sum(iharm_3_overtime)  iharm3Overtime,
            sum(iharm_4_overtime)  iharm4Overtime,
            sum(iharm_5_overtime)  iharm5Overtime,
            sum(iharm_6_overtime)  iharm6Overtime,
            sum(iharm_7_overtime)  iharm7Overtime,
            sum(iharm_8_overtime)  iharm8Overtime,
            sum(iharm_9_overtime)  iharm9Overtime,
            sum(iharm_10_overtime)  iharm10Overtime,
            sum(iharm_11_overtime)  iharm11Overtime,
            sum(iharm_12_overtime)  iharm12Overtime,
            sum(iharm_13_overtime)  iharm13Overtime,
            sum(iharm_14_overtime)  iharm14Overtime,
            sum(iharm_15_overtime)  iharm15Overtime,
            sum(iharm_16_overtime)  iharm16Overtime,
            sum(iharm_17_overtime)  iharm17Overtime,
            sum(iharm_18_overtime)  iharm18Overtime,
            sum(iharm_19_overtime)  iharm19Overtime,
            sum(iharm_20_overtime)  iharm20Overtime,
            sum(iharm_21_overtime)  iharm21Overtime,
            sum(iharm_22_overtime)  iharm22Overtime,
            sum(iharm_23_overtime)  iharm23Overtime,
            sum(iharm_24_overtime)  iharm24Overtime,
            sum(iharm_25_overtime)  iharm25Overtime,
            sum(inuharm_1_overtime) inuharm1Overtime,
            sum(inuharm_2_overtime) inuharm2Overtime,
            sum(inuharm_3_overtime) inuharm3Overtime,
            sum(inuharm_4_overtime) inuharm4Overtime,
            sum(inuharm_5_overtime) inuharm5Overtime,
            sum(inuharm_6_overtime) inuharm6Overtime,
            sum(inuharm_7_overtime) inuharm7Overtime,
            sum(inuharm_8_overtime) inuharm8Overtime,
            sum(inuharm_9_overtime) inuharm9Overtime,
            sum(inuharm_10_overtime) inuharm10Overtime,
            sum(inuharm_11_overtime) inuharm11Overtime,
            sum(inuharm_12_overtime) inuharm12Overtime,
            sum(inuharm_13_overtime) inuharm13Overtime,
            sum(inuharm_14_overtime) inuharm14Overtime,
            sum(inuharm_15_overtime) inuharm15Overtime,
            sum(inuharm_16_overtime) inuharm16Overtime,
            sum(i_neg_overtime)  iNegOvertime
        from
            r_stat_limit_rate_d
        where
            time_id between #{statTime} and #{endTime}
            <if test=" ids != null and ids.size > 0">
                AND my_index IN
                <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
        group by
            my_index
    </select>

    <select id="getAllOverTimes" resultType="com.njcn.csharmonic.pojo.po.RStatLimitRateDPO">
        select
            my_index as lineId,
            SUM(freq_dev_overtime
                    + flicker_overtime
                    + voltage_dev_overtime
                    + ubalance_overtime
                    + uaberrance_overtime
                    + i_neg_overtime
                    + uharm_2_overtime + uharm_3_overtime + uharm_4_overtime + uharm_5_overtime + uharm_6_overtime + uharm_7_overtime + uharm_8_overtime + uharm_9_overtime + uharm_10_overtime + uharm_11_overtime + uharm_12_overtime + uharm_13_overtime + uharm_14_overtime + uharm_15_overtime + uharm_16_overtime + uharm_17_overtime + uharm_18_overtime + uharm_19_overtime + uharm_20_overtime + uharm_21_overtime + uharm_22_overtime + uharm_23_overtime + uharm_24_overtime + uharm_25_overtime
                    + iharm_2_overtime + iharm_3_overtime + iharm_4_overtime + iharm_5_overtime + iharm_6_overtime + iharm_7_overtime + iharm_8_overtime + iharm_9_overtime + iharm_10_overtime + iharm_11_overtime + iharm_12_overtime + iharm_13_overtime + iharm_14_overtime + iharm_15_overtime + iharm_16_overtime + iharm_17_overtime + iharm_18_overtime + iharm_19_overtime + iharm_20_overtime + iharm_21_overtime + iharm_22_overtime + iharm_23_overtime + iharm_24_overtime + iharm_25_overtime
                    + inuharm_1_overtime + inuharm_2_overtime + inuharm_3_overtime + inuharm_4_overtime + inuharm_5_overtime + inuharm_6_overtime + inuharm_7_overtime + inuharm_8_overtime + inuharm_9_overtime + inuharm_10_overtime + inuharm_11_overtime + inuharm_12_overtime + inuharm_13_overtime + inuharm_14_overtime + inuharm_15_overtime + inuharm_16_overtime
            ) as allTime
        from
            r_stat_limit_rate_d
        <where>
            and time_id between #{statTime} and #{endTime}
            <if test=" ids != null and ids.size > 0">
                AND my_index IN
                <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
        </where>
        group by
            my_index
    </select>
</mapper>
