初始化项目

This commit is contained in:
2024-04-01 09:20:31 +08:00
commit fefd704e6e
4694 changed files with 1869737 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<?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.AssesMapper'>
<select id="getVol" resultType="asses">
SELECT
AVG(VU_DEV) VU_DEV ,
AVG(Freq_Dev) Freq_Dev ,
AVG(Data_PLT) Data_PLT ,
AVG(V_Unbalance_CP95) V_Unbalance_CP95 ,
AVG(V_THD_CP95) V_THD_CP95
FROM
PQS_ASSES
WHERE
TIMEID BETWEEN #{startTime}
AND #{endTime}
AND LINEID IN
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="getSynData" resultType="pqsComasses">
SELECT
T .LINEID,
AVG (T .freq_Dev1) freqDev1,
AVG (T .freq_Dev2) freqDev2,
AVG (T .freq_Dev3) freqDev3,
AVG (T .freq_Dev4) freqDev4,
AVG (T .freq_Dev5) freqDev5,
AVG (T .vu_Dev1) vuDev1,
AVG (T .vu_Dev2) vuDev2,
AVG (T .vu_Dev3) vuDev3,
AVG (T .vu_Dev4) vuDev4,
AVG (T .vu_Dev5) vuDev5,
AVG (T .data_Pst1) dataPst1,
AVG (T .data_Pst2) dataPst2,
AVG (T .data_Pst3) dataPst3,
AVG (T .data_Pst4) dataPst4,
AVG (T .data_Pst5) dataPst5,
AVG (T .v_Unbalance1) vUnbalance1,
AVG (T .v_Unbalance2) vUnbalance2,
AVG (T .v_Unbalance3) vUnbalance3,
AVG (T .v_Unbalance4) vUnbalance4,
AVG (T .v_Unbalance5) vUnbalance5,
AVG (T .v_Thd1) vThd1,
AVG (T .v_Thd2) vThd2,
AVG (T .v_Thd3) vThd3,
AVG (T .v_Thd4) vThd4,
AVG (T .v_Thd5) vThd5,
AVG (T .event1) event1,
AVG (T .event2) event2,
AVG (T .event3) event3,
AVG (T .event4) event4,
AVG (T .event5) event5
FROM
PQS_COMASSES T
where
TIMEID BETWEEN #{startTime}
AND #{endTime}
and LINEID in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY
LINEID
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.1//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.mapper.data.EventAssMapper">
<select id="getCountsByInterval" resultType="Integer" databaseId="Oracle">
select count(*) from PQS_EVENTDETAIL where to_char(TIMEID,'YYYY-MM') = #{interTime} AND EVENTASS_INDEX is not null
</select>
<select id="getCountsByInterval" resultType="Integer" databaseId="MariaDB">
select count(*) from PQS_EVENTDETAIL where
date_format(TIMEID,'%Y-%m') = #{interTime} AND EVENTASS_INDEX is not null
</select>
</mapper>

View File

@@ -0,0 +1,726 @@
<?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">
<select id="queryVoltageCountsByLineIndexs" resultType="Integer">
SELECT
count(1)
FROM
PQS_EVENTDETAIL
WHERE
LINEID IN
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
AND TIMEID between #{startTime} and #{endTime}
AND WaveType=1
</select>
<select id="querySubLevel" resultType="simpleValue">
SELECT
t1.name name,
t2.allcount value
FROM
pq_substation t1,
(
SELECT
COUNT (A.lineid) allcount
FROM
pqs_eventdetail A,
pq_line b,
pq_substation c,
PQ_DEVICE d
WHERE
c.sub_index = #{subIndex}
AND b.sub_index = c.sub_index
AND A .lineid = b.line_index
AND b.DEV_INDEX=d.DEV_INDEX
AND d.DEVMODEL = 1
AND d.DATATYPE in (0,2)
and b.line_index in
<foreach collection="lineIndex" open="(" close=")" separator="," item="lineId">
#{lineId}
</foreach>
and a.TIMEID between #{startTime}
and #{endTime}
) t2
WHERE
t1.sub_index =#{subIndex}
</select>
<select id="queryLineLevel" resultType="simpleValue" databaseId="Oracle">
select * from
(
select
LINEID name,
count(1) VALUE
FROM
PQS_EVENTDETAIL A
WHERE
TIMEID between #{startTime} and #{endTime}
AND
LINEID IN
<foreach collection="lineIndex" item="item" index="index"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY LINEID
ORDER BY VALUE DESC)
WHERE ROWNUM <![CDATA[ <= ]]>
30
</select>
<select id="queryLineLevel" resultType="simpleValue" databaseId="MariaDB">
select * from
(
select
LINEID name,
count(1) VALUE
FROM
PQS_EVENTDETAIL A
WHERE
TIMEID between #{startTime} and #{endTime}
AND
LINEID IN
<foreach collection="lineIndex" item="item" index="index"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY LINEID
ORDER BY VALUE DESC) as t
limit 30
</select>
<select id="queryEventDetail" resultType="StatisticsEventDetail" databaseId="Oracle">
SELECT
M .TIMEID,
M.EVENTDETAIL_INDEX,
to_char(M .TIMEID,'YYYY-mm-dd
hh24:mi:ss.')||M.MS time,
round(M.PERSISTTIME/1000,3) PERSISTTIME,
round(M.EVENTVALUE*100,2) EVENTVALUE,
M.EVENTREASON,
M.EVENTTYPE,
M.NAME,
M.LINEID,
S.DIC_NAME SCALE,
S1.DIC_NAME LOADTYPE,
s2.name gdName,
s3.name subName
FROM
(SELECT
T1.TIMEID,
T1.EVENTDETAIL_INDEX,
nvl(substr(10000+T1.MS,-3),T1.MS) MS,
T1.PERSISTTIME,
T1.EVENTVALUE,
T2.DIC_NAME EVENTREASON,
T3.BACK_UP EVENTTYPE,
T4. NAME,
T1.LINEID,
T4.SCALE,
T4.SUB_INDEX,
T4.GD_INDEX,
T5.LOADTYPE
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_LINEDETAIL T5 ON
T1.LINEID=T5.LINE_INDEX
WHERE
T1.LINEID IN
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
AND
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
and T1.WaveType &lt;&gt; 5
)M
INNER JOIN
PQS_DICDATA S ON M.SCALE=S.DIC_INDEX
INNER JOIN PQS_DICDATA
S1 ON
M.LOADTYPE=S1.DIC_INDEX
INNER JOIN PQ_GDINFORMATION S2 ON
M.gd_index=S2.gd_INDEX
INNER JOIN PQ_SUBSTATION S3 ON
M.sub_index=S3.sub_index
</select>
<select id="queryEventDetail" resultType="StatisticsEventDetail" databaseId="MariaDB">
SELECT
M .TIMEID,
M.EVENTDETAIL_INDEX,
CONCAT(date_format(M .TIMEID,'%Y-%m-%d %H:%i:%S.'), M.MS) time,
round(M.PERSISTTIME/1000,3) PERSISTTIME,
round(M.EVENTVALUE*100,2) EVENTVALUE,
M.EVENTREASON,
M.EVENTTYPE,
M.NAME,
M.LINEID,
S.DIC_NAME SCALE,
S1.DIC_NAME LOADTYPE,
s2.name gdName,
s3.name subName
FROM
(SELECT
T1.TIMEID,
T1.EVENTDETAIL_INDEX,
nvl(substr(10000+T1.MS,-3),T1.MS) MS,
T1.PERSISTTIME,
T1.EVENTVALUE,
T2.DIC_NAME EVENTREASON,
T3.BACK_UP EVENTTYPE,
T4. NAME,
T1.LINEID,
T4.SCALE,
T4.SUB_INDEX,
T4.GD_INDEX,
T5.LOADTYPE
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_LINEDETAIL T5 ON
T1.LINEID=T5.LINE_INDEX
WHERE
T1.LINEID IN
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
AND
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
and T1.WaveType &lt;&gt; 5
)M
INNER JOIN
PQS_DICDATA S ON M.SCALE=S.DIC_INDEX
INNER JOIN PQS_DICDATA
S1 ON
M.LOADTYPE=S1.DIC_INDEX
INNER JOIN PQ_GDINFORMATION S2 ON
M.gd_index=S2.gd_INDEX
INNER JOIN PQ_SUBSTATION S3 ON
M.sub_index=S3.sub_index
</select>
<select id="queryVoltageList" resultType="eventDetail" databaseId="Oracle">
SELECT
M.EVENTDETAIL_INDEX,
M.LINEID,
M.WAVETYPE,
M.fileflag,
TO_CHAR (
M.TIMEID,
'YYYY-mm-dd hh24:mi:ss.'
) || M.MS TIME,
ROUND (M.PERSISTTIME / 1000, 3) PERSISTTIME,
ROUND(M.EVENTVALUE * 100 ,2) EVENTVALUE,
M .EVENTREASON,
M .EVENTTYPE,
M . NAME lineName,
M .EVENTASS_INDEX,
M .severity,
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.FILEFLAG,
NVL (
SUBSTR (10000 + T1.MS ,- 3),
T1.MS
) MS,
T1.PERSISTTIME,
T1.severity,
T1.EVENTVALUE,
T1.WAVETYPE,
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 &lt; #{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 &lt; #{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 &lt; #{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>
<select id="queryVoltageList" resultType="eventDetail" databaseId="MariaDB">
SELECT
M .EVENTDETAIL_INDEX,
M .LINEID,
M.WAVETYPE,
m.fileflag,
CONCAT(date_format(M .TIMEID,'%Y-%m-%d %H:%i:%S.'), M.MS) time,
round(M
.PERSISTTIME/1000, 3) PERSISTTIME,
round(M.EVENTVALUE*100,2) EVENTVALUE,
M
.EVENTREASON,
M .EVENTTYPE,
M .NAME lineName,
M.EVENTASS_INDEX,
M.severity,
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.FILEFLAG,
nvl(substr(10000+T1.MS,-3),T1.MS) MS,
T1.PERSISTTIME,
T1.severity,
T1.EVENTVALUE,
T1.WAVETYPE,
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>
) 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>
<select id="getCountsByInterval" resultType="Integer" databaseId="Oracle">
select count(*) from PQS_EVENTDETAIL where to_char(TIMEID,'YYYY-MM') =
#{interTime} and LINEID in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
AND WaveType=1
</select>
<select id="getCountsByInterval" resultType="Integer" databaseId="MariaDB">
select count(*) from PQS_EVENTDETAIL where date_format(TIMEID,'%Y-%m') =
#{interTime} and LINEID in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
AND
WaveType=1
</select>
<select id="getrunevent" resultType="eventDetail" databaseId="Oracle">
select * from (select
pq_line.name
lineName,pqs_eventdetail.timeid
timeId,c.dic_name as eventType
from
pq_gdinformation,pq_substation,pq_subvoltage,pq_line,pqs_eventdetail,pqs_dicdata
c
where
pq_line.subv_index = pq_subvoltage.subv_index
and
pqs_eventdetail.eventass_index is null
AND
pqs_eventdetail.LINEID IN
<foreach collection="lineIndex" item="item" index="index"
open="(" separator="," close=")">
#{item}
</foreach>
and
pq_line.sub_index =
pq_substation.sub_index and pq_line.gd_index =
pq_gdinformation.gd_index and pq_line.line_index =
pqs_eventdetail.lineid
and pqs_eventdetail.eventtype=c.dic_index
order
by pqs_eventdetail.timeid desc)
where ROWNUM <![CDATA[ <= ]]>10
</select>
<select id="getrunevent" resultType="eventDetail" databaseId="MariaDB">
select * from (select
pq_line.name
lineName,pqs_eventdetail.timeid
timeId,c.dic_name as eventType
from
pq_gdinformation,pq_substation,pq_subvoltage,pq_line,pqs_eventdetail,pqs_dicdata
c
where
pq_line.subv_index = pq_subvoltage.subv_index
and
pqs_eventdetail.eventass_index is null
and
pq_line.sub_index =
pq_substation.sub_index and pq_line.gd_index =
pq_gdinformation.gd_index and pq_line.line_index =
pqs_eventdetail.lineid
and pqs_eventdetail.eventtype=c.dic_index
order
by pqs_eventdetail.timeid desc) as t
limit 10
</select>
<select id="queryDealFlag" resultType="java.lang.Integer"
parameterType="java.lang.String">
select dealflag from pqs_eventdetail where
eventdetail_index = #{indexEvt}
</select>
<update id="updateDealFlag">
update pqs_eventdetail set dealflag = #{code} where
eventdetail_index = #{indexEvt}
</update>
<update id="updateCause">
update pqs_eventdetail set eventreason = (select
a.dic_index from pqs_dicdata a,pqs_dictype b where b.dictype_name =
'暂降原因' and a.dic_type = b.dictype_index and a.triphase = #{code} and
a.state = 1 and b.state = 1)
where
eventdetail_index = #{indexEvt}
</update>
<select id="querySagDescriptionbyId" resultType="java.lang.String">
select
a.dic_name from pqs_dicdata a,pqs_dictype b where b.dictype_name =
#{typename} and a.dic_type = b.dictype_index and a.triphase =#{code}
and a.state = 1 and b.state = 1
</select>
<select id="querySagDescriptionbyIndex" resultType="java.lang.String">
select
b.dic_name from pqs_dicdata b,pqs_eventdetail
a where a.eventreason =
b.dic_index and a.eventdetail_index =
#{indexEvt}
</select>
<update id="updateSagData">
update pqs_eventdetail
set eventtype =(select
a.dic_index from pqs_dicdata a,pqs_dictype b where b.dictype_name =
'暂降类型' and a.dic_type = b.dictype_index and a.triphase =
#{sagEvent.sagType} and a.state = 1 and b.state = 1)
,dqtime =
#{sagEvent.dqTime},
num =
#{sagEvent.number},firsttime =
#{sagEvent.firstTime},firstms =
#{sagEvent.firstMs}
,firsttype = (select
a.dic_index from pqs_dicdata
a,pqs_dictype b where b.dictype_name =
'暂降类型' and a.dic_type =
b.dictype_index and a.triphase =
#{sagEvent.firstType} and a.state = 1 and b.state = 1)
where
eventdetail_index =
#{sagEvent.indexEventDetail}
</update>
<update id="updateSeverity" >
update
PQS_EVENTDETAIL
set
Severity = #{severity}
where
EVENTDETAIL_INDEX=#{index}
</update>
<select id="queryLineEvents" resultType="simpleValue" databaseId="Oracle">
select i."LINE_NAME" as name, i."GD_NAME" as gdName, i."SUB_NAME" as subName, h.totalcount value
from ((select distinct MainTable.lineid, NVL(SubTable.count, 0) totalcount
from pqs_eventdetail MainTable
LEFT JOIN (select count(*) count, lineid
from pqs_eventdetail
where WAVETYPE = 1 and timeid between #{startTime} and #{endTime}
group by lineid
order by lineid) SubTable
ON MainTable.lineid = SubTable.lineid) h RIGHT JOIN
(select a.line_index line_index, a.name line_name, b.name gd_name, c.name sub_name
from pq_line a, pq_gdinformation b,pq_substation c, pq_device e
where a.gd_index = b.gd_index
and a.sub_index = c.sub_index
and a.dev_index = e.dev_index
and e.devmodel = 1
and e.datatype in (0, 2)
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
) i ON h.lineid = i.line_index)
where h.totalcount > 0 and rownum &lt; 101
order by value desc
</select>
<select id="queryLineEvents" resultType="simpleValue" databaseId="MariaDB">
select i.LINE_NAME as name, i.GD_NAME as gdName, i.SUB_NAME as subName, h.totalcount value
from ((select distinct MainTable.lineid, NVL(SubTable.count, 0) totalcount
from pqs_eventdetail MainTable
LEFT JOIN (select count(*) count, lineid
from pqs_eventdetail
where WAVETYPE = 1
and timeid between #{startTime} and #{endTime}
group by lineid
order by lineid) SubTable
ON MainTable.lineid = SubTable.lineid) h RIGHT JOIN
(select a.line_index line_index, a.name line_name, b.name gd_name, c.name sub_name
from pq_line a, pq_gdinformation b,pq_substation c, pq_device e
where a.gd_index = b.gd_index
and a.sub_index = c.sub_index
and a.dev_index = e.dev_index
and e.devmodel = 1
and e.datatype in (0, 2)
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
) i ON h.lineid = i.line_index)
where h.totalcount > 0
order by value desc LIMIT 10
</select>
<resultMap type="com.njcn.pojo.commons.EventInfoDetail" id="EventInfoDetailMapperMap"
autoMapping="true">
<id property="eventDetailIndex" column="EVENTDETAIL_INDEX"/>
</resultMap>
<select id="eventDetailBaseInfoByIndex" resultMap="EventInfoDetailMapperMap">
SELECT LINE.name lineName,
gd.name gdName,
sub.name bdzName,
dev.name devName,
dic.dic_name scale,
dev.ip ip,
EV.EVENTDETAIL_INDEX eventDetailIndex,
EV.TIMEID timeID,
EV.PERSISTTIME / 1000 persistTime,
round(EV.EVENTVALUE * 100,2) eventValue,
ev.ms ms
FROM PQS_EVENTDETAIL ev,
PQ_LINE line,
PQ_GDINFORMATION gd,
PQ_SUBSTATION sub,
PQ_DEVICE dev,
PQS_DICDATA dic
WHERE line.line_index = ev.lineid
AND gd.gd_index = line.gd_index
AND sub.sub_index = line.sub_index
AND dev.dev_index = line.dev_index
and dic.dic_index = line.scale
AND ev.eventdetail_index = #{eventdetailIndex}
</select>
<select id="getPtType" resultType="java.lang.Integer">
select b.pttype
from pqs_eventdetail a, pq_linedetail b
where a.eventdetail_index = #{eventIndex}
and a.lineid = b.line_index
</select>
<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>
<select id="getSuspendByMonitor" resultType="java.lang.Integer">
SELECT
NVL(COUNT(1),0)
FROM
PQS_EVENTDETAIL T1
WHERE
T1.TIMEID
BETWEEN #{startTime} AND #{endTime}
and T1.LINEID in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
and T1.WAVETYPE = 1
</select>
</mapper>

View File

@@ -0,0 +1,95 @@
<?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>

View File

@@ -0,0 +1,119 @@
<?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.IntegrityMapper'>
<select id="selectIntegralityByLineIndexAndTime" resultType="simpleValue">
SELECT
SUM (T1.real) countOnline,
SUM (T1.due) countAll
FROM
PQS_Integrity T1
WHERE
T1.Line_index in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="selectGwIntegralityByLineIndexAndTime" resultType="simpleValue">
SELECT
SUM (T1.real) countOnline,
SUM (T1.due) countAll
FROM
PQS_NGCPINTEGRITY T1
WHERE
T1.Line_index in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="selectGistIntegrality" resultType="simpleValue">
SELECT
t1.integrality,
t2. NAME,
T3.NAME devName,
t3.ip,
t4.name gdName,
t5.name subName
FROM
(
SELECT
T .*, ROWNUM row_num
FROM
(
SELECT
LINE_INDEX,
ROUND ( SUM (REAL) / SUM (DUE),4) * 100 integrality
FROM
PQS_INTEGRITY
WHERE
LINE_INDEX IN <foreach collection="list" item="item" open="(" close=")" separator=",">#{item}</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
GROUP BY
LINE_INDEX
ORDER BY
integrality ASC
) T
) t1
LEFT JOIN PQ_LINE t2 ON t1.LINE_INDEX = t2.LINE_INDEX
LEFT JOIN PQ_DEVICE t3 ON t2.dev_index = t3.dev_index
LEFT JOIN PQ_GDINFORMATION t4 ON t2.GD_INDEX = t4.GD_INDEX
LEFT JOIN PQ_SUBSTATION t5 ON T2.SUB_INDEX = T5.SUB_INDEX
WHERE t1.row_num &lt; 20
</select>
<select id="selectIntegrityData" resultType="intergralityTable" >
SELECT
T6. NAME powerCompany,
T7. NAME substation,
T3. NAME device,
T3.IP deviceIp,
T3.UpdateTime updateTime,
T3.Status status,
T3.DevFlag devFlag,
T5.DIC_NAME company,
T8.DIC_NAME voltage,
T2.NAME lineName,
T1.integrity integrity
FROM
(
SELECT
T1.LINE_INDEX,
ROUND (
SUM (T1.REAL) / (
SUM (T1.DUE)
),
4
) * 100 integrity
FROM
PQS_Integrity T1
WHERE
T1.LINE_INDEX IN <foreach collection="list" item="item" open="(" close=")" separator=",">#{item}</foreach>
AND t1.TIMEID BETWEEN #{startTime} AND #{endTime}
GROUP BY
T1.LINE_INDEX
) T1,
PQ_LINE T2,
PQ_DEVICE T3,
PQ_DEVICEDETAIL T4,
PQS_DICDATA T5,
PQ_GDINFORMATION T6,
PQ_SUBSTATION T7,
PQS_DICDATA T8
WHERE
T1.LINE_INDEX = T2.LINE_INDEX
AND T2.DEV_INDEX = T3.DEV_INDEX
AND T3.DEV_INDEX =T4.DEV_INDEX
AND T4.MANUFACTURER=T5.DIC_INDEX
AND T2.GD_INDEX=T6.GD_INDEX
AND T2.SUB_INDEX=T7.SUB_INDEX
AND T2.SCALE=T8.DIC_INDEX
</select>
</mapper>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.1//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.mapper.data.LineMapsMapper">
<select id="queryLineMaps" parameterType="String" resultType="LineMaps" >
select * from line_maps where line_index in
<foreach collection="lstGDsql" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryLineMapByAssID" parameterType="String" resultType="LineMaps" >
select a.*
from line_maps a,pqs_eventdetail b
where a.line_index=b.lineid and b.eventass_index=#{eventass_index}
</select>
<select id="queryLineMapsForAll" parameterType="String" resultType="LineMaps" >
SELECT
i."LINE_INDEX",
i."LINE_NAME",
i."PT1",
i."PT2",
i."CT1",
i."CT2",
i."GD_INDEX",
i."GD_NAME",
i."SUB_NAME",
i."SUBV_NAME",
i."DEVFLAG",
i."STATUS",
i."IP",
i."MANUFACTURER",
i."LONGITUDE",
i."LATITUDE",
NVL( h.totalcount, 0 ) totalcount
FROM
(
(
SELECT DISTINCT
MainTable.lineid,
NVL( SubTable.count, 0 ) totalcount
FROM
pqs_eventdetail MainTable
LEFT JOIN (
SELECT
count( * ) count,
lineid
FROM
pqs_eventdetail
where eventass_index is null
and timeid >= TRUNC( SYSDATE, 'YYYY' )
GROUP BY
lineid
ORDER BY
lineid
) SubTable ON MainTable.lineid = SubTable.lineid
) h
RIGHT JOIN (
SELECT
a.line_index line_index,
a.name line_name,
a.pt1 pt1,
a.pt2 pt2,
a.ct1 ct1,
a.ct2 ct2,
b.gd_index gd_index,
b.name gd_name,
c.name sub_name,
d.name subv_name,
e.devflag devflag,
e.status status,
e.ip ip,
h.dic_name manufacturer,
f.longitude longitude,
f.latitude latitude
FROM
pq_line a,
pq_gdinformation b,
pq_substation c,
pq_subvoltage d,
pq_device e,
pqs_map f,
pq_devicedetail g,
pqs_dicdata h
WHERE
a.gd_index = b.gd_index
AND a.sub_index = c.sub_index
AND a.subv_index = d.subv_index
AND a.dev_index = e.dev_index
AND a.sub_index = f.sub_index
AND e.dev_index = g.dev_index
AND f.state = 1
AND g.manufacturer = h.dic_index
AND h.dic_type = 'cbb2de8a-87da-4ae9-a35c-aaab999c7bc7' --只读取实际设备
AND e.devmodel = 1 --只读取属于暂降系统数据
AND e.datatype IN ( 0, 2 )
ORDER BY
a.line_index
) i ON h.lineid = i.line_index
) where LINE_INDEX in
<foreach collection="lstGDsql" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,14 @@
<?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.SynDataMapper'>
<!-- 删除 -->
<update id="deleteByIndex">
delete from Pqs_syndata where myIndex = #{myIndex} and node = #{node}
</update>
<select id="getSynData" resultType="Float">
select synData from pqs_syndata where myIndex = #{myIndex} and node = #{node}
</select>
</mapper>