<?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.advance.mapper.BalanceMapper">

    <select id="getFeatureAmplitude" resultType="AdvanceBaseDTO">
        select avg(feature_amplitude) valueA,measurement_point_id lineId
        from r_mp_event_detail
        where start_time between #{startTime} and #{endTime}
        and measurement_point_id in
        <foreach collection="lineIds" open="(" close=")" separator="," item="item">
            #{item}
        </foreach>
        group by measurement_point_id
    </select>


    <select id="getSarfi" resultType="AdvanceBaseDTO">
        select count(1) as valueB,measurement_point_id lineId
        from r_mp_event_detail
        where start_time between #{startTime} and #{endTime}
        and measurement_point_id in
        <foreach collection="lineIds" open="(" close=")" separator="," item="item">
            #{item}
        </foreach>
        and duration &lt; 60
        and feature_amplitude &lt; #{featureAmplitude}
        group by measurement_point_id
    </select>


    <select id="getSarfiSeverity" resultType="AdvanceBaseDTO">
        select avg(severity*duration) as valueA,measurement_point_id lineId
        from r_mp_event_detail
        where start_time between #{startTime} and #{endTime}
        and measurement_point_id in
        <foreach collection="lineIds" open="(" close=")" separator="," item="item">
            #{item}
        </foreach>
        and duration &lt; 60
        and feature_amplitude &lt; #{featureAmplitude}
        group by measurement_point_id
    </select>




</mapper>
