<?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.CsEventPOMapper">
  <resultMap id="BaseResultMap" type="com.njcn.csharmonic.pojo.po.CsEventPO">
    <!--@mbg.generated-->
    <!--@Table cs_event-->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="line_id" jdbcType="VARCHAR" property="lineId" />
    <result column="device_id" jdbcType="VARCHAR" property="deviceId" />
    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
    <result column="tag" jdbcType="VARCHAR" property="tag" />
    <result column="wave_id" jdbcType="VARCHAR" property="waveId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, line_id, device_id, start_time, tag, wave_id
  </sql>


    <select id="getEventDesc" resultType="com.njcn.csharmonic.pojo.vo.CsWarnDescVO">
        SELECT
            t1.line_id id,
            t2.NAME,
            CONCAT(
            DATE_FORMAT( t1.start_time, '%Y-%m-%d %H:%i:%s' ),
            '.',
            LPAD( FLOOR( MICROSECOND( t1.start_time ) / 1000 ), 3, '0' )
            ) AS timeId,
            t1.amplitude,
            t1.persist_time
        FROM
            cs_event t1,
            cs_line t2
        WHERE
            t1.line_id = t2.line_id
          and t1.line_id in
        <foreach collection="lineIdList" item="lineId" separator="," open="(" close=")">
            #{lineId}
        </foreach>
          and t1.type = 0
        order by t1.start_time DESC
        LIMIT 60
    </select>

</mapper>