<?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.event.mapper.majornetwork.ReportMapper">

    <select id="getBreakTimes" resultType="com.njcn.event.pojo.vo.DetailVO">
        SELECT
        rmed.measurement_point_id lineId,
        count(*) times
        FROM r_mp_event_detail rmed
        WHERE
        rmed.measurement_point_id IN
        <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
        <if test="startTime != null and startTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
        </if>
        <if test="endTime != null and endTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
        </if>
        and rmed.event_type = #{dictdata}
        GROUP BY rmed.measurement_point_id
    </select>

    <select id="getUpTimes" resultType="com.njcn.event.pojo.vo.DetailVO">
        SELECT
        rmed.measurement_point_id lineId,
        count(*) times
        FROM r_mp_event_detail rmed
        WHERE
        rmed.measurement_point_id IN
        <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
        <if test="startTime != null and startTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
        </if>
        <if test="endTime != null and endTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
        </if>
        and rmed.event_type = #{dictdata}
        GROUP BY rmed.measurement_point_id
    </select>

    <select id="getSagTimes" resultType="com.njcn.event.pojo.vo.DetailVO">
        SELECT
        rmed.measurement_point_id lineId,
        count(*) times
        FROM r_mp_event_detail rmed
        WHERE
        rmed.measurement_point_id IN
        <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
        <if test="startTime != null and startTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
        </if>
        <if test="endTime != null and endTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
        </if>
        and rmed.event_type = #{dictdata}
        GROUP BY rmed.measurement_point_id
    </select>
    <select id="getListCount" resultType="com.njcn.event.pojo.vo.DetailVO">
        SELECT
        rmed.measurement_point_id lineId,
        count(*) times
        FROM r_mp_event_detail rmed
        WHERE
        rmed.measurement_point_id IN
        <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
        <if test="startTime != null and startTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
        </if>
        <if test="endTime != null and endTime != ''">
            and date_format(rmed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
        </if>
        and rmed.event_type = #{dictdata}
        GROUP BY rmed.measurement_point_id
    </select>

</mapper>