<?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.RStatAbnormalDMapper">
  <resultMap id="BaseResultMap" type="com.njcn.prepare.harmonic.pojo.mysql.RStatAbnormalDPO">
    <!--@mbg.generated-->
    <!--@Table r_stat_abnormal_d-->
    <id column="data_date" jdbcType="DATE" property="dataDate" />
    <id column="measurement_point_id" jdbcType="VARCHAR" property="measurementPointId" />
    <result column="value_alarm" jdbcType="INTEGER" property="valueAlarm" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    data_date, measurement_point_id, value_alarm
  </sql>

  <select id="handlerMonitorAbnormal" resultType="com.njcn.prepare.harmonic.pojo.mysql.RStatAbnormalDPO">
    SELECT
    #{format} dataDate,
    measurement_point_id,
    CASE
    WHEN a.effective_minute_count&lt;a.all_minute_count then
    0
    ELSE
    1
    END value_alarm
    FROM
    r_mp_monitor_evaluate_d a where
    a.data_date between #{beginDay} and #{endDay}
    AND a.measurement_point_id
    IN
    <foreach collection="pendingId" item="lineId" separator="," open="(" close=")">
      #{lineId}
    </foreach>

  </select>
</mapper>