<?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.mapper.data.EventPzMapper'>
	<resultMap type="EventPz" id="eventPzMap" autoMapping="true">
		<id column="EVENTDETAIL_INDEX" property="eventdetalIndex" />
	</resultMap>
<select id="getZjsj" resultMap="eventPzMap" databaseId="Oracle">
    SELECT
    even.eventdetail_index indexEventDetail,
    even.timeid TIME,
    even.ms msec,
    round(even.persisttime/1000, 3) persisttime,
    even.describe EVENTS,
    even.EventValue eventValue,
    lin.line_index indexPoint,
    lin. NAME lineName,
    sg. NAME nameSubV,
    sb. NAME nameBD,
    gd. NAME nameGD,
    c.dic_name eventType
    FROM
    (
    SELECT
    *
    FROM
    pqs_eventdetail event
    WHERE
    event.eventass_index IS NULL
    AND
    event.LINEID IN
    <foreach collection="lineIndex" item="item" index="index"
             open="(" separator="," close=")">
        #{item}
    </foreach>
    ORDER BY
    event.timeid DESC
    ) even
    LEFT JOIN (SELECT * FROM PQ_LINE) lin ON lin.line_index = even.lineid
    LEFT JOIN (SELECT * FROM pq_subvoltage) sg ON lin.subv_index = sg.subv_index
    LEFT JOIN (SELECT * FROM pq_substation) sb ON lin.sub_index = sb.sub_index
    LEFT JOIN (SELECT * FROM PQ_GDINFORMATION) gd ON lin.gd_index = gd.gd_index
    LEFT JOIN (SELECT * FROM PQS_DICDATA) c ON even.eventtype = c.dic_index
    WHERE
    ROWNUM &lt;=100
</select>
<select id="getZjsj" resultMap="eventPzMap" databaseId="MariaDB">
    (SELECT
    even.eventdetail_index indexEventDetail,
    even.timeid TIME,
    even.ms msec,
    round(even.persisttime/1000, 3) persisttime,
    even.`describe` EVENTS,
    even.EventValue eventValue,
    lin.line_index indexPoint,
    lin. NAME lineName,
    sg. NAME nameSubV,
    sb. NAME nameBD,
    gd. NAME nameGD,
    c.dic_name eventType
    FROM
    (
    SELECT
    *
    FROM
    pqs_eventdetail event
    WHERE
    event.eventass_index IS NULL
    AND
    event.LINEID IN
    <foreach collection="lineIndex" item="item" index="index"
             open="(" separator="," close=")">
        #{item}
    </foreach>
    ) even
    LEFT JOIN (SELECT * FROM PQ_LINE) lin ON lin.line_index = even.lineid
    LEFT JOIN (SELECT * FROM pq_subvoltage) sg ON lin.subv_index = sg.subv_index
    LEFT JOIN (SELECT * FROM pq_substation) sb ON lin.sub_index = sb.sub_index
    LEFT JOIN (SELECT * FROM PQ_GDINFORMATION) gd ON lin.gd_index = gd.gd_index
    LEFT JOIN (SELECT * FROM PQS_DICDATA) c ON even.eventtype = c.dic_index
    ORDER BY
    timeid DESC
    )LIMIT 100
</select>


    <update id="dealEventWarn" parameterType="list">
        update pqs_eventdetail set look_flag = 1
        where eventdetail_index in
        <foreach collection="list" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </update>
</mapper>
