224 lines
6.6 KiB
XML
224 lines
6.6 KiB
XML
|
|
<?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.EventDetailMapper'>
|
||
|
|
<resultMap type="com.njcn.pojo.data.EventDetail" id="EventDetailMapperMap" autoMapping="true">
|
||
|
|
<id property="lineId" column="LINEID"/>
|
||
|
|
</resultMap>
|
||
|
|
<select id="queryZj" resultMap="EventDetailMapperMap">
|
||
|
|
select timeId,EVENTDETAIL_INDEX from pqs_eventdetail where
|
||
|
|
<if test="_databaseId == 'MariaDB'">
|
||
|
|
str_to_date(timeid,'%Y-%m-%d')
|
||
|
|
</if>
|
||
|
|
<if test="_databaseId == 'Oracle'">
|
||
|
|
to_char(timeid,'yyyy-mm-DD')
|
||
|
|
</if>
|
||
|
|
between #{startTime}
|
||
|
|
and #{endTime} and
|
||
|
|
<if test="_databaseId == 'MariaDB'">
|
||
|
|
str_to_date(timeid,'%H:%i:%s')
|
||
|
|
</if>
|
||
|
|
<if test="_databaseId == 'Oracle'">
|
||
|
|
to_char(timeid,'hh24:mm:ss')
|
||
|
|
</if>
|
||
|
|
between #{start} and #{end}
|
||
|
|
and lineid = #{lineId} order by TIMEID asc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<select id="queryVoltageList" resultType="eventDetail">
|
||
|
|
SELECT
|
||
|
|
M .EVENTDETAIL_INDEX,
|
||
|
|
M .LINEID,
|
||
|
|
M.WAVETYPE,
|
||
|
|
m.fileflag,
|
||
|
|
<if test="_databaseId == 'MariaDB'">
|
||
|
|
CONCAT(str_to_date( M.TIMEID, '%Y-%m-%d %H:%i:%s'),'.',M.MS) time,
|
||
|
|
</if>
|
||
|
|
<if test="_databaseId == 'Oracle'">
|
||
|
|
to_char(M .TIMEID,'YYYY-mm-dd hh24:mi:ss.')||M.MS time,
|
||
|
|
</if>
|
||
|
|
round(M .PERSISTTIME/1000, 3) PERSISTTIME,
|
||
|
|
round(M.EVENTVALUE*100,2) EVENTVALUE,
|
||
|
|
M .EVENTREASON,
|
||
|
|
M .EVENTTYPE,
|
||
|
|
M.severity,
|
||
|
|
M .NAME lineName,
|
||
|
|
M.EVENTASS_INDEX,
|
||
|
|
S. NAME GDNAME,
|
||
|
|
S1. NAME SUBNAME,
|
||
|
|
S2.DIC_NAME SCALE,
|
||
|
|
S3.IP,
|
||
|
|
M.DEVTYPE devtype
|
||
|
|
FROM
|
||
|
|
(
|
||
|
|
SELECT
|
||
|
|
T1.EVENTDETAIL_INDEX,
|
||
|
|
T1.LINEID,
|
||
|
|
T1.TIMEID,
|
||
|
|
T1.WAVETYPE,
|
||
|
|
T1.FILEFLAG,
|
||
|
|
nvl(substr(10000+T1.MS,-3),T1.MS) MS,
|
||
|
|
T1.PERSISTTIME,
|
||
|
|
T1.EVENTVALUE,
|
||
|
|
T1.severity,
|
||
|
|
T2.DIC_NAME EVENTREASON,
|
||
|
|
T3.DIC_NAME EVENTTYPE,
|
||
|
|
T1.EVENTASS_INDEX,
|
||
|
|
T4.NAME,
|
||
|
|
T4.GD_INDEX GDINDEX,
|
||
|
|
T4.SUB_INDEX SUBINDEX,
|
||
|
|
T4.SCALE,
|
||
|
|
T4.DEV_INDEX DEVINDEX,
|
||
|
|
s5.DIC_NAME DEVTYPE
|
||
|
|
FROM
|
||
|
|
PQS_EVENTDETAIL T1
|
||
|
|
INNER JOIN PQS_DICDATA T2 ON T1.EVENTREASON = T2.DIC_INDEX
|
||
|
|
INNER JOIN PQS_DICDATA T3 ON T1.EVENTTYPE = T3.DIC_INDEX
|
||
|
|
INNER JOIN PQ_LINE T4 ON T1.LINEID = T4.LINE_INDEX
|
||
|
|
INNER JOIN pq_device S4 ON T4 .dev_index = S4.Dev_index
|
||
|
|
INNER JOIN PQS_DICDATA S5 ON S4.devtype=S5 .DIC_INDEX
|
||
|
|
WHERE
|
||
|
|
T1.TIMEID
|
||
|
|
BETWEEN #{startTime} AND #{endTime}
|
||
|
|
and T1.LINEID in
|
||
|
|
<foreach collection="list" item="item" index="index" open="("
|
||
|
|
separator="," close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
<if test="minfuzhi !=null and maxfuzhi!=null">
|
||
|
|
and T1.EVENTVALUE between #{minfuzhi} and #{maxfuzhi}
|
||
|
|
</if>
|
||
|
|
<if test="minfuzhi !=null and maxfuzhi==null">
|
||
|
|
and T1.EVENTVALUE > #{minfuzhi}
|
||
|
|
</if>
|
||
|
|
<if test="minfuzhi ==null and maxfuzhi!=null">
|
||
|
|
and T1.EVENTVALUE < #{maxfuzhi}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="mintime !=null and maxtime!=null">
|
||
|
|
and T1.PERSISTTIME between #{mintime} and #{maxtime}
|
||
|
|
</if>
|
||
|
|
<if test="mintime !=null and maxtime==null">
|
||
|
|
and T1.PERSISTTIME > #{mintime}
|
||
|
|
</if>
|
||
|
|
<if test="mintime ==null and maxtime!=null">
|
||
|
|
and T1.PERSISTTIME < #{maxtime}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="minseverity !=null and maxseverity!=null">
|
||
|
|
and T1.severity between #{minseverity} and #{maxseverity}
|
||
|
|
</if>
|
||
|
|
<if test="minseverity !=null and maxseverity==null">
|
||
|
|
and T1.severity > #{minseverity}
|
||
|
|
</if>
|
||
|
|
<if test="minseverity ==null and maxseverity!=null">
|
||
|
|
and T1.severity < #{maxseverity}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
|
||
|
|
<if test="eventType!=null">
|
||
|
|
and T1.EVENTTYPE in
|
||
|
|
<foreach collection="eventType" item="item" index="index" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="eventReason!=null">
|
||
|
|
and T1.EVENTREASON in
|
||
|
|
<foreach collection="eventReason" item="item" index="index" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="triggerType!=null">
|
||
|
|
and T1.WAVETYPE in
|
||
|
|
<foreach collection="triggerType" item="item" index="index" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="fileflag!=null">
|
||
|
|
and T1.FILEFLAG = #{fileflag}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
) M
|
||
|
|
INNER JOIN PQ_GDINFORMATION S ON M .GDINDEX = S.GD_INDEX
|
||
|
|
INNER JOIN PQ_SUBSTATION S1 ON M .SUBINDEX = S1.SUB_INDEX
|
||
|
|
INNER JOIN PQS_DICDATA S2 ON M . SCALE = S2.DIC_INDEX
|
||
|
|
INNER JOIN pq_device S3 ON M . DEVINDEX = S3.Dev_index
|
||
|
|
ORDER BY
|
||
|
|
M .TIMEID DESC
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="updateSeverity">
|
||
|
|
update
|
||
|
|
PQS_EVENTDETAIL
|
||
|
|
set
|
||
|
|
Severity = #{severity}
|
||
|
|
where
|
||
|
|
EVENTDETAIL_INDEX=#{index}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="selectByIndex" resultType="eventDetail">
|
||
|
|
SELECT
|
||
|
|
EVENTDETAIL_INDEX,
|
||
|
|
LINEID,
|
||
|
|
TIMEID,
|
||
|
|
MS,
|
||
|
|
WAVETYPE,
|
||
|
|
PERSISTTIME,
|
||
|
|
EVENTVALUE,
|
||
|
|
EVENTREASON,
|
||
|
|
EVENTTYPE,
|
||
|
|
EVENTASS_INDEX,
|
||
|
|
DQTIME,
|
||
|
|
DEALTIME,
|
||
|
|
NUM,
|
||
|
|
FILEFLAG,
|
||
|
|
DEALFLAG,
|
||
|
|
FIRSTTIME,
|
||
|
|
FIRSTTYPE,
|
||
|
|
FIRSTMS,
|
||
|
|
WAVENAME,
|
||
|
|
Energy,
|
||
|
|
Severity
|
||
|
|
FROM
|
||
|
|
PQS_EVENTDETAIL
|
||
|
|
WHERE
|
||
|
|
EVENTDETAIL_INDEX = #{eventIndex}
|
||
|
|
</select>
|
||
|
|
<select id="selectByTimeIdAndLineIndex" resultType="eventDetail">
|
||
|
|
SELECT
|
||
|
|
EVENTDETAIL_INDEX,
|
||
|
|
LINEID,
|
||
|
|
TIMEID,
|
||
|
|
MS,
|
||
|
|
WAVETYPE,
|
||
|
|
PERSISTTIME,
|
||
|
|
EVENTVALUE,
|
||
|
|
EVENTREASON,
|
||
|
|
EVENTTYPE,
|
||
|
|
EVENTASS_INDEX,
|
||
|
|
DQTIME,
|
||
|
|
DEALTIME,
|
||
|
|
NUM,
|
||
|
|
FILEFLAG,
|
||
|
|
DEALFLAG,
|
||
|
|
FIRSTTIME,
|
||
|
|
FIRSTTYPE,
|
||
|
|
FIRSTMS,
|
||
|
|
WAVENAME,
|
||
|
|
Energy,
|
||
|
|
Severity
|
||
|
|
FROM
|
||
|
|
PQS_EVENTDETAIL
|
||
|
|
WHERE
|
||
|
|
TIMEID = #{timeId}
|
||
|
|
and
|
||
|
|
MS = #{ms}
|
||
|
|
and
|
||
|
|
lineId =#{lineId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
</mapper>
|