<?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.prepare.harmonic.mapper.mysql.line.AlarmMapper">

    <select id="getAvgDiffData" resultType="com.njcn.prepare.harmonic.pojo.dto.AlarmDetailDayDTO">
        select
            line_id lineId,
            avg(vl_dev) vlDev,
            avg(freq_dev) freqDev,
            avg(v_unbalance) vUnbalance,
            avg(v_harmonic) vHarmonic,
            avg(plt) plt,
            avg(sag_times) sagTimes,
            avg(interrupt_times) interruptTimes
        from
            r_mp_target_diff_d
        where `time` between #{startTime} and #{endTime}
        <if test="list != null and list.size() > 0">
            and line_id in
            <foreach collection="list" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        group by line_id
    </select>
</mapper>
