初始化项目

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,67 @@
################################通用且因环境变化而变化
#波形文路径(本地配置)
WAVE_PATH=C:/Comtrade
#服务器临时文件路径(用于存储离线、报告存储)
TMP_PATH=C:/
#webSocket
WEBSOCKET=ws://127.0.0.1:8080/pqs9000/websocket/
#socket端口配置
SOCKETPORT=60000
#Kafka
ZOOKEEPER=192.168.1.41:21815
GROUPID=test-consumer-group
TOPIC=realdata
KAFKA_LOG=true
#报表生成路径
REPORT_PATH=https://www.pqmcc.com:8040/shiningCloud/appfiles/
#报告模板路径
#四川
#rtfPath=file/reportModelSC.docx
#冀北
rtfPath=file/reportModelJB.docx
#北京
#rtfPath=file/reportModelBJ.docx
#海南
#rtfPath=file/reportModelHN.docx
picPath=file/default.jpg
#服务器白名单
SYSTEM_HOST=192.168.1.211
#是否输出业务日志
BUSINESS_LOG_FLAG=false
#监测点数量级
PID_Number=10000
#9300谐波越限天数
overRunDay=10
#报表查询条件设定(单位:天)
REPORT_DAY=3
#是否发送邮件
MAIL_FLAG=false
#邮件服务器连接地址
MAIL_HOST=smtp.qq.com
#发送方邮箱
MAIL_ADDRESS=83944980@qq.com
#SMTP授权码
SMTP_NUM=uwhilozcumpucafd
#海南短信验证
MSG_USER=1C6CC426DFE8D7C2BC42C7C19F101D80
MSG_PASSWORD=8836E651F09195FA3EE892A1B700DC65
#加密方式 0、base64 1 、3des
CDKEY_ENCY=1
################################独立配置且不随环境变化
#当前系统标志
SYSTEM_FLAG=PQS9000
#当前系统的GUID
SYS_TYPE=983f9dfe-4f9a-4c96-89d8-7d425a1f1d6c
SYS_TYPE_ZT=1cfcd6e2-c5fe-4b15-988a-32b90f1170c1
SYS_TYPE_WT=983f9dfe-4f9a-4c96-89d8-7d425a1f1d6c
#sso认证中心url
SSO_URL=http://127.0.0.1:7878/sso/user/
#如果相同容器的话直接根据request获取url配置路径否则自定义配置url
ONE_CONTAINER=true
SSO_JUDGE=http://127.0.0.1:7878/sso/user/judgeLogin?item=pqs9000
#sso认证中心完毕后前往子系统进行二次认证
#如果相同容器的话直接根据request获取url配置路径否则自定义配置url
pqs9200.regist.url=http://127.0.0.1:8080/pqs9200/user/ssoRegister?token=
pqs9000.regist.url=http://127.0.0.1:8088/pqs9000/user/ssoRegister?token=

View File

@@ -0,0 +1,61 @@
#oracle.jdbcUrl=jdbc:log4jdbc:oracle:thin:@192.168.5.166:1521:cjldata
oracle.driverClass=oracle.jdbc.driver.OracleDriver
#pqsadmin
#oracle.jdbcUrl=jdbc\:oracle\:thin\:@192.168.1.101\:1521\:pqsbase
#oracle.user=8836E651F09195FA3EE892A1B700DC65
#oracle.password=110ADDC7B3686BE36E80EB3BC5BD63E8
#oracle.jdbcUrl=jdbc\:oracle\:thin\:@192.168.1.51\:1521\:pqsbase
#oracle.user=8836E651F09195FA6312AD217B40D520
#oracle.password=8836E651F09195FA3EE892A1B700DC65
#jibei
#oracle.jdbcUrl=jdbc\:oracle\:thin\:@192.168.1.51\:1521\:pqsbase
#oracle.user=8836E651F09195FA36F59F764BEC048E
#oracle.password=8836E651F09195FA3EE892A1B700DC65
#本地 jibei
oracle.jdbcUrl=jdbc\:oracle\:thin\:@127.0.0.1\:1521\:ORCL
oracle.user=8836E651F09195FA36F59F764BEC048E
oracle.password=8836E651F09195FA3EE892A1B700DC65
# 池初始化大小
oracle.initialSize=1
# 池最小连接数
oracle.minIdle=1
# 池最大连接数
oracle.maxActive=50
# 获取连接等待超时的时间
oracle.maxWait=60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
oracle.timeBetweenEvictionRunsMillis=60000
# 一个连接在池中最小生存的时间,单位是毫秒
oracle.minEvictableIdleTimeMillis=300000
# 是否打开PSCache
oracle.poolPreparedStatements=false
# 指定每个连接上PSCache的大小
oracle.maxPoolPreparedStatementPerConnectionSize=20
#mariadb
mariadb.driverClass=org.mariadb.jdbc.Driver
#db.jdbcUrl=jdbc\:oracle\:thin\:@192.168.1.254\:1521\:orcl
mariadb.jdbcUrl=jdbc:mariadb://192.168.1.108:3306/pq?useUnicode=true&characterEncoding=utf-8&useSSL=false
#db.user=eventdata
mariadb.user=42BAAEC9A8582476
#db.user=AE17109A75AE812EF5A59A916627E318
mariadb.password=ED94C2C049B041FD
#user=eventdata1
#password=eventdata
# 池初始化大小
mariadb.initialSize=1
# 池最小连接数
mariadb.minIdle=1
# 池最大连接数
mariadb.maxActive=50
# 获取连接等待超时的时间
mariadb.maxWait=60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
mariadb.timeBetweenEvictionRunsMillis=60000
# 一个连接在池中最小生存的时间,单位是毫秒
mariadb.minEvictableIdleTimeMillis=300000
# 是否打开PSCache
mariadb.poolPreparedStatements=false
# 指定每个连接上PSCache的大小
mariadb.maxPoolPreparedStatementPerConnectionSize=20
dataSource=Oracle

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration debug="true">
<!-- 在控制台输出的日志文件info级别以上 -->
<appender name="Console" class="org.apache.log4j.ConsoleAppender">
<param name="Encoding" value="UTF-8" />
<param name="Threshold" value="ERROR" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p %c %t %m%n" />
</layout>
</appender>
<!--输出文件中该文件中只能输出info级别的日志 -->
<appender name="INFO" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Encoding" value="UTF-8" />
<param name="File" value="c:/logs/pqs9000/info/info.log" />
<!--<param name="File" value="/usr/local/logs/pqs9000/info/info.log" />-->
<param name="DatePattern" value=".yyyy-MM-dd" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p %c %t %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
</filter>
</appender>
<!--输出文件中该文件中只能输出erro级别的日志 -->
<appender name="ERROR" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Encoding" value="UTF-8" />
<param name="File" value="c:/logs/pqs9000/error/error.log" />
<!--<param name="File" value="/usr/local/logs/pqs9000/error/error.log" />-->
<param name="DatePattern" value=".yyyy-MM-dd" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p %c %t %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<root>
<priority value="INFO" />
<appender-ref ref="INFO" />
<appender-ref ref="ERROR" />
<appender-ref ref="Console" />
</root>
</log4j:configuration>

View File

@@ -0,0 +1,94 @@
<?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.pqs9000.mapper.common.HarmIMapper'>
<select id="getHarmI" resultType="harmI">
select ROUND(avg(i_2), 2) i2,
ROUND(avg(i_3), 2) i3,
ROUND(avg(i_4), 2) i4,
ROUND(avg(i_5), 2) i5,
ROUND(avg(i_6), 2) i6,
ROUND(avg(i_7), 2) i7,
ROUND(avg(i_8), 2) i8,
ROUND(avg(i_9), 2) i9,
ROUND(avg(i_10), 2) i10,
ROUND(avg(i_11), 2) i11,
ROUND(avg(i_12), 2) i12,
ROUND(avg(i_13), 2) i13,
ROUND(avg(i_14), 2) i14,
ROUND(avg(i_15), 2) i15,
ROUND(avg(i_16), 2) i16,
ROUND(avg(i_17), 2) i17,
ROUND(avg(i_18), 2) i18,
ROUND(avg(i_19), 2) i19,
ROUND(avg(i_20), 2) i20,
ROUND(avg(i_21), 2) i21,
ROUND(avg(i_22), 2) i22,
ROUND(avg(i_23), 2) i23,
ROUND(avg(i_24), 2) i24,
ROUND(avg(i_25), 2) i25,
ROUND(avg(i_26), 2) i26,
ROUND(avg(i_27), 2) i27,
ROUND(avg(i_28), 2) i28,
ROUND(avg(i_29), 2) i29,
ROUND(avg(i_30), 2) i30,
ROUND(avg(i_31), 2) i31,
ROUND(avg(i_32), 2) i32,
ROUND(avg(i_33), 2) i33,
ROUND(avg(i_34), 2) i34,
ROUND(avg(i_35), 2) i35,
ROUND(avg(i_36), 2) i36,
ROUND(avg(i_37), 2) i37,
ROUND(avg(i_38), 2) i38,
ROUND(avg(i_39), 2) i39,
ROUND(avg(i_40), 2) i40,
ROUND(avg(i_41), 2) i41,
ROUND(avg(i_42), 2) i42,
ROUND(avg(i_43), 2) i43,
ROUND(avg(i_44), 2) i44,
ROUND(avg(i_45), 2) i45,
ROUND(avg(i_46), 2) i46,
ROUND(avg(i_47), 2) i47,
ROUND(avg(i_48), 2) i48,
ROUND(avg(i_49), 2) i49,
ROUND(avg(i_50), 2) i50 from Data_i where lineId=
#{lineId} and PHASIC_TYPE != 'T' and TIMEID
between
#{startTime} and
#{endTime}
</select>
<select id="getoffHarmI" resultType="Float">
select round(max(t2.a), 2)
from (select max(CASE
WHEN a2 = #{condition.count} THEN i_${number}
ELSE NULL END) as a
FROM (SELECT t.*,
row_number() over(partition BY phasic_type ORDER BY i_${number} DESC) a2
FROM Data_i t
where lineid = #{condition.pointIndex}
and phasic_type = 'A'
and timeid between #{condition.start} and #{condition.end}) m1
UNION all
select max(CASE
WHEN b2 = #{condition.count} THEN i_${number}
ELSE NULL END) as a
FROM (SELECT t.*,
row_number() over(partition BY phasic_type ORDER BY i_${number} DESC) b2
FROM Data_i t
where lineid = #{condition.pointIndex}
and phasic_type = 'B'
and timeid between #{condition.start} and #{condition.end}) m2
UNION all
select max(CASE
WHEN c2 = #{condition.count} THEN i_${number}
ELSE NULL END) as a
FROM (SELECT t.*,
row_number() over(partition BY phasic_type ORDER BY i_${number} DESC) c2
FROM Data_i t
where lineid = #{condition.pointIndex}
and phasic_type = 'C'
and timeid between #{condition.start} and #{condition.end}) m3) t2
</select>
</mapper>

View File

@@ -0,0 +1,97 @@
<?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.pqs9000.mapper.common.HarmonicMapper'>
<select id="getHarmonic" resultType="harmonic">
select ROUND(avg(v_2), 2) v2,
ROUND(avg(v_3), 2) v3,
ROUND(avg(v_4), 2) v4,
ROUND(avg(v_5), 2) v5,
ROUND(avg(v_6), 2) v6,
ROUND(avg(v_7), 2) v7,
ROUND(avg(v_8), 2) v8,
ROUND(avg(v_9), 2) v9,
ROUND(avg(v_10), 2) v10,
ROUND(avg(v_11), 2) v11,
ROUND(avg(v_12), 2) v12,
ROUND(avg(v_13), 2) v13,
ROUND(avg(v_14), 2) v14,
ROUND(avg(v_15), 2) v15,
ROUND(avg(v_16), 2) v16,
ROUND(avg(v_17), 2) v17,
ROUND(avg(v_18), 2) v18,
ROUND(avg(v_19), 2) v19,
ROUND(avg(v_20), 2) v20,
ROUND(avg(v_21), 2) v21,
ROUND(avg(v_22), 2) v22,
ROUND(avg(v_23), 2) v23,
ROUND(avg(v_24), 2) v24,
ROUND(avg(v_25), 2) v25,
ROUND(avg(v_26), 2) v26,
ROUND(avg(v_27), 2) v27,
ROUND(avg(v_28), 2) v28,
ROUND(avg(v_29), 2) v29,
ROUND(avg(v_30), 2) v30,
ROUND(avg(v_31), 2) v31,
ROUND(avg(v_32), 2) v32,
ROUND(avg(v_33), 2) v33,
ROUND(avg(v_34), 2) v34,
ROUND(avg(v_35), 2) v35,
ROUND(avg(v_36), 2) v36,
ROUND(avg(v_37), 2) v37,
ROUND(avg(v_38), 2) v38,
ROUND(avg(v_39), 2) v39,
ROUND(avg(v_40), 2) v40,
ROUND(avg(v_41), 2) v41,
ROUND(avg(v_42), 2) v42,
ROUND(avg(v_43), 2) v43,
ROUND(avg(v_44), 2) v44,
ROUND(avg(v_45), 2) v45,
ROUND(avg(v_46), 2) v46,
ROUND(avg(v_47), 2) v47,
ROUND(avg(v_48), 2) v48,
ROUND(avg(v_49), 2) v49,
ROUND(avg(v_50), 2) v50
from Data_HarmRate_V
where lineId = #{lineId}
and PHASIC_TYPE != 'T' and TIMEID
between #{startTime}
and #{endTime}
</select>
<select id="getoffHarmonic" resultType="Float">
select round(max(t2.a), 2)
from (select max(CASE
WHEN a2 = #{condition.count} THEN v_${number}
ELSE NULL END) as a
FROM (SELECT t.*,
row_number() over(partition BY phasic_type ORDER BY v_${number} DESC) a2
FROM Data_HarmRate_V t
where lineid = #{condition.pointIndex}
and phasic_type = 'A'
and timeid between #{condition.start} and #{condition.end}) m1
UNION all
select max(CASE
WHEN b2 = #{condition.count} THEN v_${number}
ELSE NULL END) as a
FROM (SELECT t.*,
row_number() over(partition BY phasic_type ORDER BY v_${number} DESC) b2
FROM Data_HarmRate_V t
where lineid = #{condition.pointIndex}
and phasic_type = 'B'
and timeid between #{condition.start} and #{condition.end}) m2
UNION all
select max(CASE
WHEN c2 = #{condition.count} THEN v_${number}
ELSE NULL END) as a
FROM (SELECT t.*,
row_number() over(partition BY phasic_type ORDER BY v_${number} DESC) c2
FROM Data_HarmRate_V t
where lineid = #{condition.pointIndex}
and phasic_type = 'C'
and timeid between #{condition.start} and #{condition.end}) m3) t2
</select>
</mapper>

View File

@@ -0,0 +1,353 @@
<?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.configuration.DeviceDetailMapper'>
<resultMap type="DeviceDetail" id="deviceMap" autoMapping="true">
<id column="DEV_INDEX" property="devIndex"/>
</resultMap>
<select id="getDeviceDetails" resultMap="deviceMap">
select DISTINCT
a.name,
a.dev_Index devIndex,
b.gd_index as gdName,
c.name as subName,
<if test="_databaseId == 'MariaDB'">
date_format(a.logontime,'%Y-%m-%d')
</if>
<if test="_databaseId == 'Oracle'">
to_char(a.logontime, 'yyyy-MM-dd')
</if>
as time,
i.dic_name as manufacturer,
j.dic_name as DevType,
a.ip,
a.portid,
<if test="_databaseId == 'MariaDB'">
case
when a.devflag = 0 then '投运'
when a.devflag = 1 then '热备用'
when a.devflag = 2 then '停运'
end
as devflag,
case
when a.status = 0 then '中断'
when a.status = 1 then '正常'
end
as status,
</if>
<if test="_databaseId == 'Oracle'">
decode(a.devflag, 0, '投运', 1, '热备用', '停运') as devflag,
decode(a.status, 0, '中断', 1, '正常') as status,
</if>
<if test="_databaseId == 'Oracle'">
to_char(a.updatetime, 'yyyy-MM-dd hh24:mi:ss') as updatetime,
</if>
<if test="_databaseId == 'MariaDB'">
date_format(a.updatetime, '%Y-%m-%d %H:%i:%s') as updatetime,
</if>
h.onlineratetj as evaluate
from pq_device a,
pq_gdinformation b,
pq_substation c,
pq_line d,
pq_devicedetail h,
pqs_dicdata i,
pqs_dicdata j
where a.devmodel = 1
and a.datatype in (1,2)
and a.gd_index = b.gd_index
and a.sub_index = c.sub_index
and a.dev_index = h.dev_index
and h.manufacturer = i.dic_index
and a.devtype = j.dic_index
and d.dev_index = a.dev_index
and a.devflag like #{devflag}
and a.status like #{status}
and b.name like #{gdName}
and i.dic_name like #{manufacturer}
and d.line_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
order by updatetime desc
</select>
<select id="getGdname" resultMap="deviceMap">
select distinct
b.name as gdNa
from pq_device a,
pq_gdinformation b
where a.devmodel = 1
and a.datatype in (1,2)
and a.gd_index = b.gd_index
and a.gd_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<select id="getManufacturers" resultMap="deviceMap">
select
distinct i.dic_name as manufacturer
from pq_device a,
pq_line b,
pq_devicedetail h,
pqs_dicdata i
where a.devmodel = 1
and a.datatype in (1,2)
and a.dev_index = h.dev_index
and b.dev_index = a.dev_index
and h.manufacturer = i.dic_index
and b.line_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<!-- 统计装备型号 -->
<select id="getDevtype" resultMap="deviceMap">
select b.dic_name as
DevType,count(1) as yAxis from pq_device a ,
pqs_dicdata b,pq_line c where
a.DEVMODEL = 1
and a.datatype in (1,2)
and a.devtype=b.dic_index
and c.dev_index = a.dev_index
and c.line_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
group by a.devtype ,
b.dic_name
</select>
<!-- 统计终端产家 -->
<select id="getManufacturer" resultMap="deviceMap">
select T3.DIC_NAME AS manufacturer,
count(1) as yAxis from PQ_DEVICE T1
, PQ_DEVICEDETAIL t2,PQS_DICDATA T3,pq_line T4 WHERE T1.DEVMODEL = 1
and T1.datatype in (1,2)
and T1.DEV_INDEX = T2.DEV_INDEX AND T3.DIC_INDEX=T2.MANUFACTURER
and T4.DEV_INDEX = T1.DEV_INDEX
and T4.line_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
group by
T3.DIC_NAME
</select>
<!-- 统计电压等级 -->
<select id="getScale" resultMap="deviceMap">
select f.dic_name as Scale,count(1) as yAxis from pqs_dicdata
f,pq_line
a,pq_device b where b.DEVMODEL = 1
and b.datatype in (1,2)
and a.scale=f.dic_index and a.dev_index =
b.dev_index
and a.line_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
group by f.dic_name,f.dic_number
order by f.dic_number desc
</select>
<select id="getSelName" resultMap="deviceMap">
select a.ip,
a.PORTID
from pq_device a
where a.name=#{name} and a.datatype in (1,2)
</select>
<select id="getSbyc" resultMap="deviceMap">
select distinct b.name as name,
a.gd_index as gdname,
c.name as subname,
<if test="_databaseId == 'MariaDB'">
date_format(b.logontime, '%Y-%m-%d') as time,
</if>
<if test="_databaseId == 'Oracle'">
to_char(b.logontime, 'yyyy-MM-dd') as time,
</if>
(select m.dic_name from pqs_dicdata m where m.dic_index = b.devtype) as devtype,
b.ip,
b.portid as portid,
<if test="_databaseId == 'MariaDB'">
case
when a.status = 0 then '中断'
when a.status = 1 then '正常'
end
as devflag,
</if>
<if test="_databaseId == 'Oracle'">
decode(b.status, 0,'中断',1, '正常') as devflag,
</if>
<if test="_databaseId == 'Oracle'">
to_char(b.UpdateTime, 'yyyy-MM-dd hh24:mi:ss') as updatetime
</if>
<if test="_databaseId == 'MariaDB'">
date_format(b.UpdateTime, '%Y-%m-%d %H:%i:%s') as updatetime
</if>
from pq_device b,pq_gdinformation a,pq_substation c,pqs_dicdata e
where b.DEVMODEL = 1
and b.datatype in (1,2)
and a.gd_index = b.gd_index
and b.sub_index = c.sub_index
and b.DEVFLAG=0
and b.status=0
order by updatetime desc
</select>
<!-- 统计异常数量 -->
<select id="getTj" resultMap="deviceMap">
select count(1) as yAxis from pq_device b where b.status =0 and b.DEVMODEL = 1 and b.DEVFLAG=0 and b.DATATYPE
in(1,2)
</select>
<select id="queryDeviceDetailById" resultMap="deviceMap">
select distinct a.dev_index as devIndex,
a.name,
b.gd_index as gdName,
c.name as subName,
(select n.dic_name from pqs_dicdata n where n.dic_index = d.scale) as scale,
<if test="_databaseId == 'MariaDB'">
date_format(a.logontime,'%Y-%m-%d %H:%i:%s') as time,
</if>
<if test="_databaseId == 'Oracle'">
to_char(a.logontime, 'yyyy-MM-dd hh24:mi:ss') as time,
</if>
T3.DIC_NAME AS manufacturer,
(select m.dic_name from pqs_dicdata m where m.dic_index = a.devtype) as
DevType,
a.ip,
a.PORTID,
<if test="_databaseId == 'MariaDB'">
case
when a.devflag = 0 then '投运'
when a.devflag = 1 then '热备用'
when a.devflag = 2 then '停运'
end
as devflag,
case
when a.status = 0 then '中断'
when a.status = 1 then '正常'
end
as status,
</if>
<if test="_databaseId == 'Oracle'">
decode(a.DEVFLAG, 0, '正常', 1, '热备用', '停运') as devflag,
decode(a.status, 0, '中断', 1, '正常') as status,
</if>
<if test="_databaseId == 'Oracle'">
to_char(a.UpdateTime, 'yyyy-MM-dd hh24:mm:ss') as updatetime,
</if>
<if test="_databaseId == 'MariaDB'">
date_format(a.UpdateTime, '%Y-%m-%d %H:%i:%s') as updatetime,
</if>
t2.OnlineRateTj as evaluate
from pq_device a,
pq_gdinformation b,
pq_substation c,
pq_line d,
pqs_dicdata e,
PQS_OnlineRate g,
PQ_DEVICEDETAIL t2,
PQS_DICDATA T3
where a.DEVMODEL = 1
and a.datatype in (1,2)
and a.gd_index = b.gd_index
and d.dev_index =a.dev_index
and a.sub_index = c.sub_index
and d.dev_index = a.dev_index
and d.scale = e.dic_index
and g.dev_index=a.dev_index
AND T3.DIC_INDEX=T2.MANUFACTURER
AND T2.dev_index=a.dev_index
and a.dev_index = #{devIndex}
order by b.gd_index
</select>
<select id="selState" resultMap="deviceMap">
select * from pq_device b where b.DEV_INDEX=#{devIndex} and b.DATATYPE in(1,2) and b.gd_index in
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryNameBylineId" resultMap="deviceMap">
select a.name as subName, b.name, c.name as pointName
from pq_substation a, pq_device b, pq_line c
where a.sub_index = c.sub_index
and b.dev_index = c.dev_index
and c.line_index = #{lineIndex}
</select>
<select id="queryDeviceDetailByLineId" resultMap="deviceMap">
select DISTINCT
a.name,
a.dev_Index devIndex,
b.gd_index as gdName,
c.name as subName,
<if test="_databaseId == 'MariaDB'">
date_format(a.logontime,'%Y-%m-%d')
</if>
<if test="_databaseId == 'Oracle'">
to_char(a.logontime, 'yyyy-MM-dd')
</if>
as time,
i.dic_name as manufacturer,
j.dic_name as DevType,
h.DEV_LOCATION as devLocation,
h.DEV_NO as devNo,
a.ip,
a.portid,
<if test="_databaseId == 'MariaDB'">
case
when a.devflag = 0 then '投运'
when a.devflag = 1 then '热备用'
when a.devflag = 2 then '停运'
end
as devflag,
case
when a.status = 0 then '中断'
when a.status = 1 then '正常'
end
as status,
</if>
<if test="_databaseId == 'Oracle'">
decode(a.devflag, 0, '投运', 1, '热备用', '停运') as devflag,
decode(a.status, 0, '中断', 1, '正常') as status,
</if>
<if test="_databaseId == 'Oracle'">
decode(d.status, 0, '投运', 1, '热备用', '停运') as lineStatus,
</if>
<if test="_databaseId == 'Oracle'">
to_char(a.updatetime, 'yyyy-MM-dd hh24:mi:ss') as updatetime,
</if>
<if test="_databaseId == 'MariaDB'">
date_format(a.updatetime, '%Y-%m-%d %H:%i:%s') as updatetime,
</if>
h.onlineratetj as evaluate
from pq_device a,
pq_gdinformation b,
pq_substation c,
pq_line d,
pq_devicedetail h,
pqs_dicdata i,
pqs_dicdata j
where a.devmodel = 1
and a.datatype in (1,2)
and a.gd_index = b.gd_index
and a.sub_index = c.sub_index
and a.dev_index = h.dev_index
and h.manufacturer = i.dic_index
and a.devtype = j.dic_index
and d.dev_index = a.dev_index
and d.line_index = #{lineIndex}
order by updatetime desc
</select>
</mapper>

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.configuration.DeviceInfoMapper'>
<resultMap type="LineInfo" id="deviceMap" autoMapping="true">
<id column="Gd_index" property="nodeIndex" />
</resultMap>
<select id="getDeviceInfo" resultMap="deviceMap">
select
a.name,a.name lineName,a.subv_name,e.name as subName,b.updatetime,d.dic_name as
manufacturer,b.devtype,b.ip,b.status,f.loadtype loadType,
a.scale,a.pt1,a.pt2,a.ct1,a.ct2,a.jzcmp,a.dlcmp,a.xycmp,a.devcmp,f.pttype as ptvalue
from
pq_line a,pq_device b ,pq_devicedetail c,pqs_dicdata d,pq_substation e,pq_linedetail f
where
a.dev_index = b.dev_index and b.dev_index = c.dev_index and
c.manufacturer =
d.dic_index and e.sub_index = a.sub_index and f.line_index = a.line_index and
a.line_index = #{line_index}
</select>
<select id="getRunInfo" resultType="ComInformation">
select
UpdateTime,Type
from PQS_COMINFORMATION
where State = 1
and Line_Index = #{line_index}
and UpdateTime between #{startTime} and #{endTime}
order by UpdateTime
</select>
<select id="getFlowInfo" resultMap="deviceMap">
SELECT nvl(fm.fm_number,
nvl((select FM_NUMBER
from PQS_FLOWMEAL
where type = 0
and SECOND_TYPE = 0),
0)) as baseFlow,
nvl(fm2.fm_number, 0) as extendFlow,
nvl((SELECT af.actualflow
FROM PQS_MONTHFLOW af
WHERE af.DEV_INDEX = pq.DEV_INDEX
and to_char(af.timeid, 'yyyy-MM') =
to_char(sysdate, 'yyyy-MM')),
0) / nullif(((nvl(fm.fm_number,
nvl((select FM_NUMBER
from PQS_FLOWMEAL
where type = 0
and SECOND_TYPE = 0),
0))) + (nvl(fm2.fm_number, 0))) * 1024 * 1024,
0) as useFlow
FROM PQ_DEVICE pq
left join PQS_DEVEDASS ded
on pq.DEV_INDEX = ded.DEV_INDEX
and ded.STATE = 1
and ded.UPDATERESULT = 1
left join PQS_EDDATA ed
on ded.ED_INDEX = ed.ED_INDEX
left join PQS_DEVFMASS dm
on pq.DEV_INDEX = dm.DEV_INDEX
left join PQS_FLOWMEAL fm
on dm.FM_BASE_INDEX = fm.FM_INDEX
left join PQS_FLOWMEAL fm2
on dm.FM_REAM_INDEX = fm2.FM_INDEX
WHERE pq.DEVMODEL = 1
and pq.dev_index =
(select dev_index from pq_line where line_index = #{pointIndex})
</select>
</mapper>

View File

@@ -0,0 +1,132 @@
<?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.configuration.DeviceMapper'>
<update id="updateDevice">
update pq_device set DEVFLAG=#{devflag} where dev_index=#{name}
</update>
<select id="getDevicesByDevIndexs" resultType="device">
SELECT
T.DEV_INDEX,
T.DEVFLAG
FROM
PQ_DEVICE t
where
t.DEV_INDEX in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- to_Char(T1.LOGONTIME,'yyyy-MM') between #{startTime} and #{endTime} -->
<!--根据供电公司找出合理的终端索引-->
<select id="getDeviceIndexs" resultType="int">
select
t.dev_index
from
pq_device t
where
t.gd_index in
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND
t.DEVModel= #{devModel}
AND
t.DataType in
<foreach collection="type" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="getDeviceIndexsByCompanyName" resultType="Integer">
SELECT T2.DEV_INDEX from PQ_DEVICE t2
INNER JOIN(
SELECT
*
FROM
PQ_DEVICEDETAIL
WHERE
MANUFACTURER = #{comIndex}
) t1 ON
T1.dev_index=T2.DEV_INDEX
AND
T2.DEVMODEL =#{devModel}
AND
T2.DataType in
<foreach collection="type" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND
T2.Dev_Index IN
<foreach collection="list" open="(" close=")" separator="," item="item1">
#{item1}
</foreach>
</select>
<select id="getIPByEventIndex" resultType="String">
SELECT
T3.IP
FROM
PQS_EVENTDETAIL t1,
PQ_LINE t2,
PQ_DEVICE t3
WHERE
T1.LINEID = T2.LINE_INDEX
AND T2.DEV_INDEX = T3.DEV_INDEX
AND T1.EVENTDETAIL_INDEX = #{index}
</select>
<select id="getRunDeviceIndex" resultType="Integer">
SELECT
DEV_INDEX
FROM
PQ_DEVICE
WHERE
DEV_INDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item1">
#{item1}
</foreach>
AND DEVFLAG = 0
</select>
<select id="getDeviceIndexByLineIndex" resultType="int">
SELECT
DISTINCT(DEV_INDEX)
FROM
PQ_LINE
WHERE
LINE_INDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="getConnect" resultType="int">
select pttype from pq_linedetail where line_index = #{lineIndex}
</select>
<select id="deviceDescribe" resultType="String">
SELECT
'将'|| gd.name || sub.name || '下的' || device.name || '(' || device.ip || ')'
FROM
PQ_DEVICE device
LEFT JOIN PQ_GDINFORMATION gd ON device.GD_INDEX = gd.GD_INDEX
LEFT JOIN PQ_SUBSTATION sub ON device.SUB_INDEX = sub.SUB_INDEX
WHERE
device.DEV_INDEX = #{devIndex}
</select>
<select id="getDevIndex" resultType="Integer">
SELECT
dev_index
FROM
PQ_DEVICE
WHERE
DATATYPE IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND DEVMODEL = 1
</select>
</mapper>

View File

@@ -0,0 +1,194 @@
<?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.configuration.DicDataMapper">
<resultMap type="com.njcn.pojo.configuration.DicType" id="DicDataTypeMapperMap" autoMapping="true">
<id property="dicTypeIndex" column="DICTYPE_INDEX"/>
<association property="uID" autoMapping="true" javaType="User">
<id property="userIndex" column="USER_INDEX"/>
</association>
</resultMap>
<resultMap type="com.njcn.sso.pojo.user.User" id="UserMapperMap" autoMapping="true">
<id property="userIndex" column="USER_INDEX"/>
</resultMap>
<!-- 数据字典 -->
<resultMap type="com.njcn.pojo.configuration.DicData" id="DicDataMapperMap" autoMapping="true">
<id property="dicIndex" column="DIC_INDEX"/>
<collection property="uID" resultMap="UserMapperMap" ></collection>
<collection property="dt" resultMap="DicDataTypeMapperMap"></collection>
</resultMap>
<!-- 增加 -->
<insert id="insertData">
insert into Pqs_Dicdata (Dic_Index,Dic_Name,Dic_type,Dic_Number,UpdateTime,Dic_leave,User_Index,State)
values(#{dicIndex},#{dicName},#{dicType},#{dicNumber},#{updateTime},#{leave},#{dicLeave},#{state})
</insert>
<!-- 删除 -->
<update id="deleteData">
update Pqs_Dicdata set state=0 where dic_Index=#{dicIndex,jdbcType=VARCHAR}
</update>
<!-- 修改 -->
<update id="updateData">
update pqs_DicData set DIC_NAME=#{dicName},DIC_TYPE=#{dicType},UPDATETIME=#{updateTime},dic_leave=#{dicLeave} where DIC_INDEX=#{dicIndex,jdbcType=VARCHAR}
</update>
<!-- 查询排序最大 -->
<select id="selNumMax" resultType="int">
select NVL(max(dic_number),0) from pqs_dicdata where state=1 order by dic_number desc
</select>
<!-- 根據Id查詢所有 -->
<select id="selectId" resultMap="DicDataMapperMap">
select *from pqs_dicData where DIC_INDEX=#{dicIndex,jdbcType=VARCHAR} and state=1 order by dic_index
</select>
<!-- 根据typeId查询总条数 -->
<select id="selCount" resultType="java.lang.Integer">
select count(*) from pqs_dicData where dic_type=#{dicTypeIndex,jdbcType=VARCHAR} and state=1
</select>
<!-- 根据名称查询 -->
<select id="seleAll" resultMap="DicDataMapperMap">
select t.*
from
(
select
a.*
from
pqs_dicdata a,pqs_dictype b
where
a.dic_type=b.dictype_index
and a.dic_name like #{name}
and a.state=1 order by a.dic_number
) t
left join pqs_user c on t.user_index =c.user_index
</select>
<select id="setArea" resultMap="DicDataMapperMap">
select t.* from PQS_DICDATA t where t.dic_index not in(select area from pqs_depts where state=1) and t.STATE=1 and t.dic_type=(SELECT DICTYPE_INDEX from PQS_DICTYPE where DICTYPE_NAME = #{dicTypeName})
</select>
<!-- 根据typeName查询 -->
<select id="selAll" resultMap="DicDataMapperMap">
select t.*
from
(
select
a.*
from
pqs_dicdata a,pqs_dictype b
where
a.dic_type=b.dictype_index
and a.dic_type = #{typeId,jdbcType=VARCHAR}
and a.state=1 order by a.dic_number
) t
left join pqs_user c on t.user_index =c.user_index
</select>
<!-- 根据name查询所有 -->
<select id="getSelName" resultMap="DicDataMapperMap">
select * from pqs_dicdata where dic_name like #{name} and state=1
</select>
<select id="selAllId" resultMap="DicDataMapperMap">
select t.*
from
(
select
a.*
from
pqs_dicdata a,pqs_dictype b
where
a.dic_type=b.dictype_index
and a.dic_type = #{typeId,jdbcType=VARCHAR}
and a.state=1 order by a.dic_number
) t
left join pqs_user c on t.user_index =c.user_index
</select>
<!-- 查询除此之外的名称 -->
<select id="selectName" resultMap="DicDataMapperMap">
select * from pqs_Dicdata where dic_name not in (select dic_name from pqs_Dicdata where dic_index=#{dicIndex}
and
state=1) and
DIC_TYPE=#{dicType} and state = 1
</select>
<!-- 查询接线方式 -->
<select id="selectWring" resultMap="DicDataMapperMap">
select * from pqs_dicdata dt where dt.dic_type=(SELECT DICTYPE_INDEX from PQS_DICTYPE where DICTYPE_NAME = #{dicTypeName}) and dt.state = 1
</select>
<select id="selectDataName" resultMap="DicDataMapperMap">
select * from pqs_dicdata dt where dic_index =#{dicIndex} and dt.state=1 order by dt.updatetime desc
</select>
<select id="selectWiring" resultMap="DicDataMapperMap">
select * from pqs_dicdata dt where dt.dic_type=(SELECT DICTYPE_INDEX from PQS_DICTYPE where DICTYPE_NAME = #{dicTypeName}) and dt.dic_index <![CDATA[ <> ]]>#{typeId} and dt.state=1
</select>
<!-- 查询重复 -->
<select id="selectdicName" resultMap="DicDataMapperMap">
select * from pqs_dicdata where dic_name=#{dicName} and state=1
</select>
<!-- 获取离线设备树干扰源类型 -->
<select id="getOffTreeType" resultMap="DicDataMapperMap">
select distinct a.dic_name, a.dic_index
from pqs_dicdata a, pq_linedetail b, pq_line c, pq_device d
where b.loadtype = a.dic_index
and c.line_index = b.line_index
and d.dev_index = c.dev_index
and d.datatype in (1, 2)
and d.DEVModel = 2
and c.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by dic_index">
#{item}
</foreach>
</select>
<!-- 获取设备树电压等级 -->
<select id="getTreeScale" resultMap="DicDataMapperMap">
select distinct a.dic_name, a.dic_index,a.dic_number
from pqs_dicdata a,pq_device b, pq_line c, pq_subvoltage d
where d.scale = a.dic_index
and d.subv_index = c.subv_index
and b.dev_index = c.dev_index
and b.datatype in (1, 2)
and b.DEVModel = 1
and c.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by a.dic_number">
#{item}
</foreach>
</select>
<!-- 获取设备树装置厂家 -->
<select id="getTreeManc" resultMap="DicDataMapperMap">
select distinct a.dic_name, a.dic_index,a.dic_number
from pqs_dicdata a,pq_device b, pq_line c, pq_subvoltage d,pq_devicedetail e
where e.manufacturer = a.dic_index
and e.dev_index = c.dev_index
and d.subv_index = c.subv_index
and b.dev_index = c.dev_index
and b.datatype in (1, 2)
and b.DEVModel = 1
and c.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by a.dic_number">
#{item}
</foreach>
</select>
<!-- 获取设备树干扰源类型 -->
<select id="getTreeLoadType" resultMap="DicDataMapperMap">
select distinct a.dic_name, a.dic_index,a.dic_number
from pqs_dicdata a,pq_device b, pq_line c, pq_subvoltage d,pq_linedetail e
where e.loadtype = a.dic_index
and e.line_index = c.line_index
and d.subv_index = c.subv_index
and b.dev_index = c.dev_index
and b.datatype in (1, 2)
and b.DEVModel = 1
and c.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by a.dic_number">
#{item}
</foreach>
</select>
<!-- 更新字典表根据主键-->
<update id="updateByPrimaryKeyBySql">
UPDATE PQS_DICDATA
SET DIC_LEAVE = #{dicLeave}
WHERE
DIC_INDEX = #{dicIndex}
</update>
</mapper>

View File

@@ -0,0 +1,51 @@
<?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.configuration.DicDataTypeMapper">
<!-- 数据字典 -->
<resultMap type="com.njcn.pojo.configuration.DicType" id="DicDataTypeMapperMap" autoMapping="true">
<id property="dicTypeIndex" column="DICTYPE_INDEX"/>
<association property="uID" autoMapping="true" javaType="User">
<id property="userIndex" column="USER_INDEX"/>
</association>
</resultMap>
<!-- 增加 -->
<insert id="insertType">
insert into pqs_dictype(DICTYPE_INDEX,DICTYPE_NAME,DICTYPE_NUMBER,DICTYPE_DESCRIBE,USER_INDEX,UPDATETIME,STATE,SYSTYPE)
values(#{dicTypeIndex},#{dicTypeName},#{dicTypeNumber},#{dicTypeDiscribe},#{userIndex},#{updateTime},#{state},#{sysType})
</insert>
<!-- 删除 -->
<update id="deleteType">
update pqs_dicType set state=0 where DICTYPE_INDEX=#{dicTypeIndex,jdbcType=VARCHAR} and systype=#{sysType}
</update>
<!-- 修改 -->
<update id="updateType">
update pqs_dicType set DICTYPE_NAME=#{dicTypeName},DICTYPE_DESCRIBE=#{dicTypeDiscribe},UPDATETIME=#{updateTime},SYSTYPE=#{sysType} where DICTYPE_INDEX=#{dicTypeIndex,jdbcType=VARCHAR}
</update>
<!-- 查询排序最大 -->
<select id="selNumMax" resultType="int">
select max(dictype_number) from pqs_dictype where systype=#{sysType} and state=1 order by dictype_number desc
</select>
<select id="selectIndexAll" resultMap="DicDataTypeMapperMap">
select * from pqs_dictype dt join pqs_user u on dt.USER_INDEX=u.USER_INDEX where dt.systype=#{sysType} and dt.state=1 order by dt.updatetime desc
</select>
<!-- 查询 -->
<select id="All" resultMap="DicDataTypeMapperMap">
select * from pqs_dictype dt join pqs_user u on dt.USER_INDEX=u.USER_INDEX where dt.dictype_index <![CDATA[ <> ]]>#{typeId} and dt.systype=#{sysType} and dt.state=1 order by dt.updatetime desc
</select>
<!-- 查询 -->
<select id="selectTypeName" resultMap="DicDataTypeMapperMap">
select * from pqs_dictype dt join pqs_user u on dt.USER_INDEX=u.USER_INDEX where dt.dictype_index =#{typeId} and dt.systype=#{sysType} and dt.state=1 order by dt.updatetime desc
</select>
<select id="getLog" resultMap="DicDataTypeMapperMap">
select * from pqs_dictype where systype=#{sysType} and state=1 and dictype_name like '%事件类型%'
</select>
<!-- 根据dictype_name查询 -->
<select id="querybyname" resultMap="DicDataTypeMapperMap">
select * from pqs_dictype where DICTYPE_NAME=#{dicTypename,jdbcType=VARCHAR} and state=1
</select>
<!-- 查询除此之外的名称 -->
<select id="selectName" resultMap="DicDataTypeMapperMap">
select * from pqs_dictype where DICTYPE_NAME not in (select DICTYPE_NAME from pqs_dictype where DICTYPE_INDEX=#{dicTypeIndex} and systype=#{sysType} and state=1) and state = 1
</select>
</mapper>

View File

@@ -0,0 +1,14 @@
<?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.configuration.LineDetailMapper">
<select id="getAmounts" resultType="int">
SELECT
COUNT (*)
FROM
PQ_LINEDETAIL T
WHERE
TO_CHAR (T .LAST_TIME, 'yyyy-MM') = #{time}
</select>
</mapper>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
<?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.configuration.NodeInformationMapper">
<select id="selectMaxIndex" parameterType="String" resultType="Long" >
select nvl(max(node_index),0) from NodeInformation
</select>
<select id="testName" resultType="NodeInformation" >
select * from NodeInformation where node_name = #{nodeName} and node_index != #{nodeIndex} and Node_Status = 1
</select>
<select id="setIp" resultType="NodeInformation">
select t.node_ip from NODEINFORMATION t where t.node_index=#{nodeIndex}
</select>
<select id="selectAllExcelData" resultType="NodeInformationExcelBody">
select * from NODEINFORMATION
</select>
<select id="selByName" resultType="NodeInformation">
select * from NODEINFORMATION where node_name = #{nodeName} and Node_Status = 1
</select>
<select id="getMaxOrder" resultType="int">
select max(node_order) from NODEINFORMATION
</select>
</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.OnlineRateMapper'>
<select id="selectOnlineRateByDeviceIndexAndTime" resultType="simpleValue">
SELECT
SUM (T1.ONLINEMIN) countOnline,
SUM (T1.ONLINEMIN) + SUM (T1.OFFLINEMIN) countAll
FROM
PQS_ONLINERATE T1
WHERE
T1.DEV_INDEX in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="selectCityOnlineRate" resultType="simpleValue">
SELECT
t1.RATE onlineRate,
T2.NAME,
T2.ip,
t3.name gdName,
t4.name subName
FROM
(
SELECT
T .*,
ROWNUM row_num
FROM
(
SELECT
DEV_INDEX,
ROUND (
SUM (ONLINEMIN) / (
SUM (OFFLINEMIN) + SUM (ONLINEMIN)
),4) * 100 RATE
FROM
PQS_ONLINERATE
WHERE
DEV_INDEX IN
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND
TIMEID BETWEEN #{startTime} AND #{endTime}
GROUP BY
DEV_INDEX
ORDER BY
RATE ASC
) T
) t1
LEFT JOIN PQ_DEVICE t2 ON t1.dev_index = t2.dev_index
LEFT JOIN PQ_GDINFORMATION t3 ON t2.GD_INDEX =t3.GD_INDEX
LEFT JOIN PQ_SUBSTATION t4 ON T2.SUB_INDEX=T4.SUB_INDEX
WHERE t1.row_num &lt; 11
</select>
<select id="selectOnlineRate" resultType="onlineRateData">
SELECT
T5. NAME powerCompany,
T6. NAME substation,
T2. NAME device,
T2.IP deviceIp,
T4.DIC_NAME company,
T1.ONLINERATE onlineRate
FROM
(
SELECT
T1.DEV_INDEX,
ROUND (
SUM (T1.ONLINEMIN) / (
SUM (T1.ONLINEMIN) + SUM (T1.OFFLINEMIN)
),
4
) * 100 onlineRate
FROM
PQS_ONLINERATE T1
WHERE
T1.DEV_INDEX IN
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND t1.TIMEID BETWEEN #{startTime} AND #{endTime}
GROUP BY
T1.DEV_INDEX
) T1,
PQ_DEVICE T2,
PQ_DEVICEDETAIL T3,
PQS_DICDATA T4,
PQ_GDINFORMATION T5,
PQ_SUBSTATION T6
WHERE
T1.DEV_INDEX = T2.DEV_INDEX
AND T1.DEV_INDEX = T3.DEV_INDEX
AND T3.MANUFACTURER = T4.DIC_INDEX
AND T2.GD_INDEX = T5.GD_INDEX
AND T2.SUB_INDEX = T6.SUB_INDEX
</select>
<select id="getGWOnlineRate" resultType="float">
SELECT
AVG(ONLINERATE)
FROM
PQS_NGCPONLINERATE
WHERE
TIMEID BETWEEN #{startTime} AND #{endTime}
AND
LINE_INDEX IN
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,23 @@
<?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.configuration.ReportMapper'>
<select id="getAll" resultType="Report">
select * from pqs_report order by savetime desc
</select>
<insert id="insertData">
INSERT INTO PQS_REPORT ( REPORT_INDEX,REPORT_NAME,USER_INDEX,SAVETIME,UPUSER_INDEX,UPDATETIME ) VALUES
(#{reportIndex},#{reportName},#{userIndex},#{savetime},#{upuserIndex,jdbcType=VARCHAR},#{updatetime,jdbcType=DATE})
</insert>
<select id="testName" resultType="Report">
select * from pqs_report where REPORT_NAME=#{name}
</select>
<update id="updateData">
UPDATE PQS_REPORT SET REPORT_NAME = #{reportName},USER_INDEX = #{userIndex},UPUSER_INDEX = #{upuserIndex,jdbcType=VARCHAR},
SAVETIME = #{savetime},UPDATETIME = #{updatetime,jdbcType=DATE} WHERE REPORT_INDEX = #{reportIndex}
</update>
</mapper>

View File

@@ -0,0 +1,31 @@
<?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.configuration.SubStationMapper">
<select id="selectMaxIndex" parameterType="String" resultType="Long" >
select max(sub_index) from PQ_SUBSTATION
</select>
<select id="testName" resultType="SubStation" >
select * from PQ_SUBSTATION where name = #{name} and sub_index != #{subIndex}
</select>
<select id="getSubDetail" resultType="SubInfo">
SELECT
a.NAME,
b.map_index AS mapIndex,
b.latitude,
b.longitude,
a.scale
FROM
pq_substation a
LEFT JOIN pqs_map b ON b.sub_index = a.sub_index
AND b.state = 1
WHERE
a.sub_index = #{subIndex}
</select>
</mapper>

View File

@@ -0,0 +1,17 @@
<?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.configuration.SysMapper'>
<select id="getListMenu" resultType="MenuEntity">
select a.function_index guid,a.path path,a.parentnode parentNode from pqs_function a, pqs_rolefunction b where
a.function_index = b.function_index
and b.role_index in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and a.state = 1 and a.systype = #{sysType}
</select>
</mapper>

View File

@@ -0,0 +1,21 @@
<?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.configuration.TerminalLogsMapper'>
<resultMap type="TerminalLogs" id="getResultMap" autoMapping="true">
<id column="LOGS_INDEX" property="logsIndex"/>
</resultMap>
<select id="selectLogs" resultMap="getResultMap">
SELECT
*
FROM
PQS_TERMINALLOGS
WHERE
dev_index IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
ORDER BY UPDATETIME desc
</select>
</mapper>

View File

@@ -0,0 +1,929 @@
<?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.configuration.TreeMapper'>
<resultMap type="Tree" id="gdResultMap" autoMapping="true">
<id column="Gd_index" property="nodeIndex"/>
<result column="province_index" property="pId"/>
</resultMap>
<select id='getGdInfo' resultMap='gdResultMap' >
select
gd_index,name
from pq_gdinformation
where
gd_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="subResultMap" autoMapping="true">
<id column="Sub_index" property="nodeIndex"/>
<result column="gd_index" property="pId"/>
</resultMap>
<select id='getSubInfo' resultMap='subResultMap'>
select
gd_index, name,sub_index
from pq_substation
where
gd_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by sub_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="transResultMap" autoMapping="true">
<id column="TFLGASS_INDEX" property="nodeTf"/>
<result column="Sub_index" property="pId"/>
</resultMap>
<select id='getTransInfo' resultMap='transResultMap'>
select ts.sub_index,ts.tfname as name,ts.tf_index
from pqs_transformer ts
where ts.sub_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
order by updatetime desc
</select>
<resultMap type="Tree" id="devResultMap" autoMapping="true">
<id column="Dev_index" property="nodeIndex"/>
<result column="sub_index" property="pId"/>
</resultMap>
<select id='getDevInfo' resultMap='devResultMap'>
select
sub_index, name,dev_index,gd_index
from pq_device
where
DEVMODEL = 1
and datatype in (1,2)
and gd_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by dev_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="devicetMap" autoMapping="true">
<id column="Dev_index" property="nodeIndex"/>
<result column="sub_index" property="pId"/>
</resultMap>
<select id='getDevice' resultMap='devicetMap'>
select
sub_index, name,dev_index,gd_index
from pq_device
where
gd_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by dev_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="subvResultMap" autoMapping="true">
<id column="subv_index" property="nodeIndex"/>
<result column="Dev_index" property="pId"/>
</resultMap>
<resultMap type="Tree" id="lineResultMap" autoMapping="true">
<id column="line_index" property="nodeIndex"/>
<result column="subv_index" property="pId"/>
</resultMap>
<select id='getLineInfo' resultMap='lineResultMap'>
select
a.subv_index, a.name,a.line_index,b.devflag as state,b.status
from pq_line a,pq_device b
where
a.dev_index = b.dev_index
and a.line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by a.line_index">
#{item}
</foreach>
</select>
<select id='getTreeGdInfo' resultMap='gdResultMap' >
select
gd_index,name,province_index
from pq_gdinformation
where
gd_index in
(select gd_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by gd_index">
#{item}
</foreach>
</select>
<select id='getTreeSubInfo' resultMap='subResultMap'>
select
gd_index, name,sub_index
from pq_substation
where
sub_index in
(select sub_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by sub_index">
#{item}
</foreach>
</select>
<select id='getZTTreeDevInfo' resultMap='devResultMap'>
select
sub_index, name,dev_index,gd_index,ip
from pq_device
where DEVMODEL = 1
and datatype in (0, 2)
and dev_index in
(select dev_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by dev_index">
#{item}
</foreach>
</select>
<select id='getWTTreeDevInfo' resultMap='devResultMap'>
select
sub_index, name,dev_index,gd_index
from pq_device
where DEVMODEL = 1
and datatype in (1, 2)
and dev_index in
(select dev_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by dev_index">
#{item}
</foreach>
</select>
<select id='getWTTreeDevInfoOffline' resultMap='devResultMap'>
select
sub_index, name,dev_index,gd_index
from pq_device
where DEVMODEL = 2
and datatype in (1, 2)
and dev_index in
(select dev_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by dev_index">
#{item}
</foreach>
</select>
<select id='getTreeSubvInfo' resultMap='subvResultMap'>
select
dev_index, name,subv_index,sub_index
from pq_subvoltage
where
subv_index in
(select subv_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by subv_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="proJResultMap" autoMapping="true">
<id column="project_index" property="nodeIndex"/>
</resultMap>
<select id='getOffTreeProJInfo' resultMap='proJResultMap' >
select distinct a.project_index, a.name
from pq_project a,
pq_province b,
pq_gdinformation c,
pq_device d,
pq_line e
where b.project_index = a.project_index
and c.province_index = b.province_index
and e.gd_index = c.gd_index
and d.dev_index = e.dev_index
and e.line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by project_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="proVResultMap" autoMapping="true">
<id column="province_index" property="nodeIndex"/>
<id column="project_index" property="pId"/>
</resultMap>
<select id='getOffTreeProVInfo' resultMap='proVResultMap' >
select
province_index,name,project_index
from pq_province
where
province_index in
(select province_index from pq_gdinformation where gd_index in
(select gd_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close="))) order by province_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="offsubResultMap" autoMapping="true">
<id column="Sub_index" property="nodeIndex"/>
<result column="province_index" property="pId"/>
</resultMap>
<select id='getOffTreeSubInfo' resultMap='offsubResultMap'>
select b.province_index, a.name, a.sub_index
from pq_substation a, pq_province b, pq_gdinformation c
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and a.sub_index in
(select sub_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by sub_index">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="offlineResultMap" autoMapping="true">
<id column="line_index" property="nodeIndex"/>
<result column="sub_index" property="pId"/>
</resultMap>
<select id='getOffTreeLineInfo' resultMap='offlineResultMap'>
select
a.sub_index, a.name,a.line_index,b.devflag as state,b.status,d.pttype
from pq_line a,pq_device b,pq_substation c,pq_linedetail d
where
a.sub_index = c.sub_index
and a.line_index = d.line_index
and a.dev_index = b.dev_index
and a.line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by a.line_index">
#{item}
</foreach>
</select>
<select id='getDeviceWT' resultMap='devicetMap'>
select
sub_index, name,dev_index,gd_index
from pq_device
where
datatype in (1, 2) and
gd_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by dev_index">
#{item}
</foreach>
</select>
<select id='getDeviceZT' resultMap='devicetMap'>
select
sub_index, name,dev_index,gd_index
from pq_device
where
datatype in (0, 2) and
gd_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by dev_index">
#{item}
</foreach>
</select>
<select id='getProInfo' resultType='tree'>
SELECT
pro.province_index nodeIndex,
dic.DIC_NAME name
FROM
pq_province pro,
pqs_dicdata dic
WHERE
pro.name = dic.DIC_INDEX
</select>
<select id='getGdByPro' resultType='tree'>
select
gd_index nodeIndex,name,province_index pId
from pq_gdinformation
where
province_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<select id='getOffLineDevice' resultType="Tree">
select
sub_index pId, name,dev_index nodeIndex,gd_index
from pq_device
where
DEVMODEL = #{devModel}
and datatype in
<foreach collection="dataType" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
and gd_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by dev_index">
#{item}
</foreach>
</select>
<select id="getProInfoByDevice" resultType="Tree">
SELECT
t5.PROVINCE_INDEX nodeIndex,
dic.DIC_NAME name
FROM
PQ_PROVINCE t5,
pqs_dicdata dic
WHERE
T5.PROVINCE_INDEX IN (
SELECT
T4.PROVINCE_INDEX
FROM
PQ_GDINFORMATION t4
WHERE
T4.GD_INDEX IN (
SELECT DISTINCT
(t3.GD_INDEX)
FROM
PQ_LINE t3
WHERE
T3.DEV_INDEX IN (
SELECT
T2.DEV_INDEX
FROM
PQ_DEVICE t2
WHERE
T2.DATATYPE IN
<foreach collection="dataType" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
)
)
)
and
t5.name = dic.DIC_INDEX
</select>
<select id="getGDInfoByDevice" resultType="Tree">
SELECT
T4.GD_INDEX nodeIndex,
T4.NAME
FROM
PQ_GDINFORMATION t4
WHERE
T4.GD_INDEX IN (
SELECT DISTINCT
(t3.GD_INDEX)
FROM
PQ_LINE t3
WHERE
T3.DEV_INDEX IN (
SELECT
T2.DEV_INDEX
FROM
PQ_DEVICE t2
WHERE
T2.DATATYPE IN
<foreach collection="dataType" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
)
)
AND
T4.PROVINCE_INDEX=#{nodeIndex}
</select>
<select id="getSubInfoByDevice" resultType="Tree">
SELECT
T4.SUB_INDEX nodeIndex,
T4.NAME
FROM
PQ_SUBSTATION t4
WHERE
T4.GD_INDEX IN (
SELECT DISTINCT
(t3.GD_INDEX)
FROM
PQ_LINE t3
WHERE
T3.DEV_INDEX IN (
SELECT
T2.DEV_INDEX
FROM
PQ_DEVICE t2
WHERE
T2.DATATYPE IN
<foreach collection="dataType" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
)
)
AND T4.GD_INDEX = #{nodeIndex}
</select>
<select id="getDevInfoByDevice" resultType="Tree">
SELECT
T1.DEV_INDEX nodeIndex,
T1.NAME
FROM
PQ_DEVICE t1
WHERE
T1.DATATYPE IN
<foreach collection="dataType" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
AND T1.SUB_INDEX = #{nodeIndex}
</select>
<select id="getSubvInfoByDevice" resultType="Tree">
SELECT
T1.SUBV_INDEX nodeIndex,
T1.NAME
FROM
PQ_SUBVOLTAGE t1
WHERE
T1.DEV_INDEX=#{nodeIndex}
</select>
<select id="getLineInfoByDevice" resultType="Tree">
SELECT
T1.subv_index,
T1.NAME,
T1.line_index nodeIndex,
T2.devflag state,
T2.status
FROM
pq_line t1,PQ_DEVICE t2
WHERE
T1.dev_index=T2.dev_index
AND
T1.SUBV_INDEX =#{nodeIndex}
</select>
<select id="getOffYearProJInfo" resultMap="proJResultMap">
select distinct a.project_index nodeIndex, a.name name
from pq_project a,
pq_province b,
pq_gdinformation c,
pq_device d,
pq_line e,
offl_log f
where b.project_index = a.project_index
and c.province_index = b.province_index
and e.gd_index = c.gd_index
and f.line_index = e.line_index
and f.year in
<foreach collection="year" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffYearProVInfo" resultMap="proVResultMap">
select distinct a.province_index nodeIndex,
(select dic_name
from pqs_dicdata
where dic_index = a.name
and state = 1) || e.year name,
a.project_index pId
from pq_province a,
pq_gdinformation b,
pq_line c,
pq_device d,
offl_log e
where b.province_index = a.province_index
and c.gd_index = b.gd_index
and e.line_index = c.line_index
and e.year = #{year}
and c.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffYearSubInfo" resultMap="offsubResultMap">
select distinct b.province_index pId, a.name name, a.sub_index nodeIndex
from pq_substation a, pq_province b, pq_gdinformation c ,pq_line d,offl_log e,pq_device f
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and d.sub_index = a.sub_index
and e.line_index = d.line_index
and e.year = #{year}
and d.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffYearLineInfo" resultMap="offlineResultMap">
select
distinct a.sub_index pId, a.name name,a.line_index nodeIndex,e.pttype
from pq_line a,pq_device b,pq_substation c,offl_log d,pq_linedetail e
where
a.sub_index = c.sub_index
and d.line_index = a.line_index
and a.line_index = e.line_index
and d.year = #{year}
and a.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffTypeProJInfo" resultMap="proJResultMap">
select distinct a.project_index nodeIndex, a.name
from pq_project a,
pq_province b,
pq_gdinformation c,
pq_device d,
pq_line e,
pq_linedetail f
where b.project_index = a.project_index
and c.province_index = b.province_index
and e.gd_index = c.gd_index
and f.line_index = e.line_index
and f.loadtype = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffTypeProVInfo" resultMap="proVResultMap">
select distinct a.province_index nodeIndex, a.name name, a.project_index pId
from pq_province a,
pq_gdinformation b,
pq_line c,
pq_device d,
pq_linedetail e
where b.province_index = a.province_index
and c.gd_index = b.gd_index
and e.line_index = c.line_index
and e.loadtype = #{type}
and c.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffTypeSubInfo" resultMap="offsubResultMap">
select distinct b.province_index pId, a.name name, a.sub_index nodeIndex
from pq_substation a, pq_province b, pq_gdinformation c ,pq_line d,pq_linedetail e,pq_device f
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and d.sub_index = a.sub_index
and e.line_index = d.line_index
and e.loadtype = #{type}
and d.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getOffTypeLineInfo" resultMap="offlineResultMap">
select distinct
a.sub_index pId, a.name name,a.line_index nodeIndex,d.pttype
from pq_line a,pq_device b,pq_substation c,pq_linedetail d
where
a.sub_index = c.sub_index
and d.line_index = a.line_index
and d.loadtype = #{type}
and a.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="proResultMap" autoMapping="true">
<id column="province_index" property="nodeIndex"/>
</resultMap>
<select id='getTreeProInfo' resultMap='proResultMap' >
select province_index, name
from pq_province
where province_index in
(select province_index
from pq_gdinformation
where gd_index in
(select gd_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close="))) order by province_index">
#{item}
</foreach>
</select>
<select id="getScaleProVInfo" resultMap="proVResultMap">
select distinct b.province_index nodeIndex, b.name
from pq_province b,
pq_gdinformation c,
pq_subvoltage d,
pq_line e
where c.province_index = b.province_index
and e.gd_index = c.gd_index
and e.subv_index = d.subv_index
and d.scale = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getScaleGdInfo" resultMap="gdResultMap">
select distinct b.province_index pId,a.gd_index nodeIndex, a.name
from pq_province b,
pq_gdinformation a,
pq_subvoltage d,
pq_line e
where b.province_index = a.province_index
and e.gd_index = a.gd_index
and e.subv_index = d.subv_index
and d.scale = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getScaleSubInfo" resultMap="subResultMap">
select distinct b.gd_index pId,a.sub_index nodeIndex, a.name
from pq_gdinformation b,
pq_substation a,
pq_subvoltage d,
pq_line e
where b.gd_index = a.gd_index
and e.sub_index = a.sub_index
and e.subv_index = d.subv_index
and d.scale = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getScaleDevInfo" resultMap="devResultMap">
select distinct a.sub_index pId,d.dev_index nodeIndex, d.name
from pq_substation a,
pq_subvoltage b,
pq_device d,
pq_line e
where d.sub_index = a.sub_index
and e.dev_index = d.dev_index
and e.subv_index = b.subv_index
and b.scale = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getScaleSubvInfo" resultMap="subvResultMap">
select distinct b.sub_index pId,a.subv_index nodeIndex, a.name
from pq_subvoltage a,
pq_substation b,
pq_device d,
pq_line e
where b.sub_index = e.sub_index
and d.dev_index = a.dev_index
and e.subv_index = a.subv_index
and a.scale = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getMancProVInfo" resultMap="proVResultMap">
select distinct b.province_index nodeIndex, b.name
from pq_province b,
pq_devicedetail a,
pq_gdinformation c,
pq_subvoltage d,
pq_line e
where c.province_index = b.province_index
and e.gd_index = c.gd_index
and e.subv_index = d.subv_index
and a.dev_index = e.dev_index
and a.manufacturer = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getMancGdInfo" resultMap="gdResultMap">
select distinct b.province_index pId,a.gd_index nodeIndex, a.name
from pq_province b,
pq_gdinformation a,
pq_devicedetail c,
pq_subvoltage d,
pq_line e
where b.province_index = a.province_index
and e.gd_index = a.gd_index
and e.subv_index = d.subv_index
and c.dev_index = e.dev_index
and c.manufacturer = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getMancSubInfo" resultMap="subResultMap">
select distinct b.gd_index pId,a.sub_index nodeIndex, a.name
from pq_gdinformation b,
pq_substation a,
pq_devicedetail c,
pq_subvoltage d,
pq_line e
where b.gd_index = a.gd_index
and e.sub_index = a.sub_index
and e.subv_index = d.subv_index
and c.dev_index = e.dev_index
and c.manufacturer = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getMancDevInfo" resultMap="devResultMap">
select distinct a.sub_index pId,d.dev_index nodeIndex, d.name
from pq_substation a,
pq_subvoltage b,
pq_devicedetail c,
pq_device d,
pq_line e
where d.sub_index = a.sub_index
and e.dev_index = d.dev_index
and e.subv_index = b.subv_index
and c.dev_index = e.dev_index
and c.manufacturer = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getMancSubvInfo" resultMap="subvResultMap">
select distinct b.sub_index pId,a.subv_index nodeIndex, a.name
from pq_subvoltage a,
pq_substation b,
pq_devicedetail c,
pq_device d,
pq_line e
where b.sub_index = e.sub_index
and d.dev_index = a.dev_index
and e.subv_index = a.subv_index
and c.dev_index = e.dev_index
and c.manufacturer = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getLoadTypeProVInfo" resultMap="proVResultMap">
select distinct b.province_index nodeIndex, b.name
from pq_province b,
pq_linedetail a,
pq_gdinformation c,
pq_subvoltage d,
pq_line e
where c.province_index = b.province_index
and e.gd_index = c.gd_index
and e.subv_index = d.subv_index
and a.line_index = e.line_index
and a.loadtype = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getLoadTypeGdInfo" resultMap="gdResultMap">
select distinct b.province_index pId,a.gd_index nodeIndex, a.name
from pq_province b,
pq_gdinformation a,
pq_linedetail c,
pq_subvoltage d,
pq_line e
where b.province_index = a.province_index
and e.gd_index = a.gd_index
and e.subv_index = d.subv_index
and c.line_index = e.line_index
and c.loadtype = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getLoadTypeSubInfo" resultMap="subResultMap">
select distinct b.gd_index pId,a.sub_index nodeIndex, a.name
from pq_gdinformation b,
pq_substation a,
pq_linedetail c,
pq_subvoltage d,
pq_line e
where b.gd_index = a.gd_index
and e.sub_index = a.sub_index
and e.subv_index = d.subv_index
and c.line_index = e.line_index
and c.loadtype = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getLoadTypeDevInfo" resultMap="devResultMap">
select distinct a.sub_index pId,d.dev_index nodeIndex, d.name
from pq_substation a,
pq_subvoltage b,
pq_linedetail c,
pq_device d,
pq_line e
where d.sub_index = a.sub_index
and e.dev_index = d.dev_index
and e.subv_index = b.subv_index
and c.line_index = e.line_index
and c.loadtype = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<select id="getLoadTypeSubvInfo" resultMap="subvResultMap">
select distinct b.sub_index pId,a.subv_index nodeIndex, a.name
from pq_subvoltage a,
pq_substation b,
pq_linedetail c,
pq_device d,
pq_line e
where b.sub_index = e.sub_index
and d.dev_index = a.dev_index
and e.subv_index = a.subv_index
and c.line_index = e.line_index
and c.loadtype = #{type}
and e.line_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by nodeIndex">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="nodesubvResultMap" autoMapping="true">
<id column="subv_index" property="nodeIndex"/>
<result column="Sub_index" property="pId"/>
</resultMap>
<select id='getNodeTreeSubvInfo' resultMap='nodesubvResultMap'>
select
sub_index, name,subv_index,sub_index
from pq_subvoltage
where
subv_index in
(select subv_index
from pq_line
where line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")) order by subv_index">
#{item}
</foreach>
</select>
</mapper>

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,23 @@
<?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.pqs9000.mapper.data.DataIMapper'>
<select id="getHistoryData" resultType="Responsibility">
SELECT
T1.TIMEID TIME,
max(T1.I_${time}) value
FROM
data_I T1
WHERE
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
AND T1.LINEID = #{lineIndex}
AND T1.PHASIC_TYPE in('A','B','C')
GROUP BY
T1.TIMEID
ORDER BY
T1.TIMEID asc
</select>
</mapper>

View File

@@ -0,0 +1,39 @@
<?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.pqs9000.mapper.data.DataVMapper'>
<select id="getHistoryData" resultType="Responsibility">
SELECT
T1.TIMEID TIME,
max(T1.v_${time}) value
FROM
Data_HarmRate_V T1
WHERE
T1.TIMEID BETWEEN #{startTime} AND #{endTime}
AND T1.LINEID = #{lineIndex}
AND T1.PHASIC_TYPE in('A','B','C')
GROUP BY
T1.TIMEID
ORDER BY
T1.TIMEID asc
</select>
<select id="queryData" resultType="DataV">
SELECT
*
FROM
Data_V T1
WHERE
<if test="_databaseId == 'MariaDB'">
T1.TIMEID BETWEEN str_to_date(#{startTime},'%Y-%m-%d %H:%i:%s')
AND str_to_date(#{endTime}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="_databaseId == 'Oracle'">
T1.TIMEID BETWEEN to_date(#{startTime}, 'yyyy-MM-dd Hh24:mi::ss')
AND to_date(#{endTime}, 'yyyy-MM-dd Hh24:mi::ss')
</if>
AND T1.LINEID = #{lineIndex}
</select>
</mapper>

View File

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

View File

@@ -0,0 +1,965 @@
<?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.HistoryDataMapper'>
<select id="getXVrValue" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then RMS else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then RMS else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then RMS else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then RMS_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then RMS_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then RMS_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then RMS_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then RMS_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then RMS_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then RMS_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then RMS_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then RMS_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid asc
</select>
<select id="getLVrValue" resultType="historyData">
select TIMEID timeId,RMSAB aAvrValue,RMSBC bAvrValue,RMSCA cAvrValue
,RMSAB_MAX aMaxValue,RMSBC_MAX bMaxValue,RMSCA_MAX cMaxValue,RMSAB_MIN aMinValue
,RMSBC_MIN bMinValue,RMSCA_MIN cMinValue,RMSAB_CP95 aCP95Value
,RMSBC_CP95 bCP95Value,RMSCA_CP95 cCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type='T' order by timeid
</select>
<select id="getDypc" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then VU_DEV else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then VU_DEV else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then VU_DEV else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then VU_DEV_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then VU_DEV_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then VU_DEV_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then VU_DEV_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then VU_DEV_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then VU_DEV_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then VU_DEV_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then VU_DEV_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then VU_DEV_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getSxbphd" resultType="historyData">
select TIMEID timeId,V_Unbalance fAvrValue,V_Unbalance_MAX fMaxValue
,V_Unbalance_MIN fMinValue,V_Unbalance_CP95 fCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type='T' order by timeid
</select>
<select id="getBphdy" resultType="historyData">
select TIMEID timeId,V_ZERO aAvrValue,V_POS bAvrValue,V_NEG cAvrValue
,V_ZERO_MAX aMaxValue,V_POS_MAX bMaxValue,V_NEG_MAX cMaxValue
,V_ZERO_MIN aMinValue,V_POS_MIN bMinValue,V_NEG_MIN cMinValue
,V_ZERO_CP95 aCP95Value,V_POS_CP95 bCP95Value,V_NEG_CP95 cCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type='T' order by timeid
</select>
<select id="getDyzjbl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then V_THD else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then V_THD else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then V_THD else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then V_THD_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then V_THD_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then V_THD_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then V_THD_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then V_THD_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then V_THD_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then V_THD_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then V_THD_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then V_THD_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getDlyxz" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then RMS else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then RMS else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then RMS else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then RMS_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then RMS_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then RMS_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then RMS_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then RMS_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then RMS_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then RMS_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then RMS_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then RMS_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_i
</when>
<otherwise>
data_i_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getFxdl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='T' then I_NEG else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then I_NEG_MAX else 0 end) fMaxValue
,sum(case when Phasic_Type='T' then I_NEG_MIN else 0 end) fMinValue
,sum(case when Phasic_Type='T' then I_NEG_CP95 else 0 end) fCP95Value from
<choose>
<when test="flagday == 1">
data_i
</when>
<otherwise>
data_i_take
</otherwise>
</choose>
where lineid = #{lineIndex}
and phasic_type ='T'
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
and timeid between to_date(#{startTime},'yyyy-MM-dd hh24:mi:ss') and to_date(#{endTime},'yyyy-MM-dd hh24:mi:ss')
</if>
group by timeid order by timeid
</select>
<select id="getPl" resultType="historyData">
select TIMEID timeId,Freq fAvrValue,Freq_MAX fMaxValue,Freq_MIN fMinValue
,Freq_CP95 fCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type='T' order by timeid
</select>
<select id="getJbhyl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then V_1 else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then V_1 else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then V_1 else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then V_1_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then V_1_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then V_1_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then V_1_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then V_1_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then V_1_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then V_1_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then V_1_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then V_1_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_v
</when>
<otherwise>
data_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getXbhyl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then V_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then V_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then V_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then V_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then V_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then V_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then V_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then V_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then V_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then V_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then V_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then V_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmrate_v
</when>
<otherwise>
data_harmrate_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getJxbhyl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then V_${innumber} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then V_${innumber} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then V_${innumber} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then V_${innumber}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then V_${innumber}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then V_${innumber}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then V_${innumber}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then V_${innumber}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then V_${innumber}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then V_${innumber}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then V_${innumber}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then V_${innumber}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_inharm_v
</when>
<otherwise>
data_inharm_v_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getXbdlfz" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then I_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then I_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then I_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then I_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then I_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then I_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then I_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then I_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then I_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then I_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then I_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then I_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_i
</when>
<otherwise>
data_i_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getYggl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then P else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then P else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then P else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then P_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then P_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then P_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then P_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then P_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then P_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then P_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then P_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then P_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid
</select>
<select id="getYgzgl" resultType="historyData">
select TIMEID timeId
,sum(case when Phasic_Type='T' then P else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then P_MAX else 0 end) fMaxValue
,sum(case when Phasic_Type='T' then P_MIN else 0 end) fMinValue
,sum(case when Phasic_Type='T' then P_CP95 else 0 end) fCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid
</select>
<select id="getWggl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then Q else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then Q else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then Q else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then Q_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then Q_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then Q_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then Q_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then Q_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then Q_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then Q_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then Q_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then Q_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_q
</when>
<otherwise>
data_harmpower_q_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid
</select>
<select id="getWgzgl" resultType="historyData">
select TIMEID timeId
,sum(case when Phasic_Type='T' then Q else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then Q_MAX else 0 end) fMaxValue
,sum(case when Phasic_Type='T' then Q_MIN else 0 end) fMinValue
,sum(case when Phasic_Type='T' then Q_CP95 else 0 end) fCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_q
</when>
<otherwise>
data_harmpower_q_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid
</select>
<select id="getSzgl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then S else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then S else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then S else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then S_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then S_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then S_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then S_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then S_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then S_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then S_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then S_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then S_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_s
</when>
<otherwise>
data_harmpower_s_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getSzglys" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then PF else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then PF else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then PF else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then PF_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then PF_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then PF_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then PF_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then PF_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then PF_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then PF_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then PF_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then PF_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getZSzglys" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='T' then PF else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then PF else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then PF_MAX else 0 end) fMaxValue
,sum(case when Phasic_Type='T' then PF_MIN else 0 end) fMinValue
,sum(case when Phasic_Type='T' then PF_CP95 else 0 end) fCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getWyglys" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then DF else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then DF else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then DF else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then DF_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then DF_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then DF_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then DF_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then DF_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then DF_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then DF_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then DF_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then DF_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getZWyglys" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='T' then DF else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then DF_MAX else 0 end) fMaxValue
,sum(case when Phasic_Type='T' then DF_MIN else 0 end) fMinValue
,sum(case when Phasic_Type='T' then DF_CP95 else 0 end) fCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getSzzgl" resultType="historyData">
select TIMEID timeId
,sum(case when Phasic_Type='T' then S else 0 end) fAvrValue
,sum(case when Phasic_Type='T' then S_MAX else 0 end) fMaxValue
,sum(case when Phasic_Type='T' then S_MIN else 0 end) fMinValue
,sum(case when Phasic_Type='T' then S_CP95 else 0 end) fCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_s
</when>
<otherwise>
data_harmpower_s_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getDlzjbl" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then I_THD else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then I_THD else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then I_THD else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then I_THD_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then I_THD_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then I_THD_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then I_THD_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then I_THD_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then I_THD_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then I_THD_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then I_THD_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then I_THD_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_i
</when>
<otherwise>
data_i_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type != 'T' group by timeid order by timeid
</select>
<select id="getCssb" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then PLT else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then PLT else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then PLT else 0 end) cAvrValue from
<choose>
<when test="flagday == 1">
data_plt
</when>
<otherwise>
data_plt_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getDssb" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then PST else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then PST else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then PST else 0 end) cAvrValue from
<choose>
<when test="flagday == 1">
data_flicker
</when>
<otherwise>
data_flicker_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getDybd" resultType="historyData">
select TIMEID timeId,sum(case when Phasic_Type='A' then FLUC else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then FLUC else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then FLUC else 0 end) cAvrValue from
<choose>
<when test="flagday == 1">
data_fluc
</when>
<otherwise>
data_fluc_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
and phasic_type!='T' group by timeid order by timeid
</select>
<select id="getXbIXj" resultType="historyData">
select TIMEID timeId,
sum(case when Phasic_Type='A' then I_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then I_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then I_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then I_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then I_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then I_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then I_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then I_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then I_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then I_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then I_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then I_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
Data_HarmPhasic_I
</when>
<otherwise>
DATA_HARMPHASIC_I_TAKE
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getXbVXj" resultType="historyData">
select TIMEID timeId,
sum(case when Phasic_Type='A' then V_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then V_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then V_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then V_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then V_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then V_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then V_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then V_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then V_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then V_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then V_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then V_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
Data_HarmPhasic_V
</when>
<otherwise>
DATA_HARMPHASIC_V_TAKE
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getXbYGGl" resultType="historyData">
select TIMEID timeId,
sum(case when Phasic_Type='A' then P_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then P_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then P_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then P_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then P_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then P_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then P_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then P_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then P_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then P_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then P_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then P_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_p
</when>
<otherwise>
data_harmpower_p_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getXbWGGl" resultType="historyData">
select TIMEID timeId,
sum(case when Phasic_Type='A' then Q_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then Q_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then Q_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then Q_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then Q_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then Q_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then Q_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then Q_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then Q_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then Q_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then Q_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then Q_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_Q
</when>
<otherwise>
data_harmpower_Q_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
<select id="getXbSZGl" resultType="historyData">
select TIMEID timeId,
sum(case when Phasic_Type='A' then S_${number} else 0 end) aAvrValue
,sum(case when Phasic_Type='B' then S_${number} else 0 end) bAvrValue
,sum(case when Phasic_Type='C' then S_${number} else 0 end) cAvrValue
,sum(case when Phasic_Type='A' then S_${number}_MAX else 0 end) aMaxValue
,sum(case when Phasic_Type='B' then S_${number}_MAX else 0 end) bMaxValue
,sum(case when Phasic_Type='C' then S_${number}_MAX else 0 end) cMaxValue
,sum(case when Phasic_Type='A' then S_${number}_MIN else 0 end) aMinValue
,sum(case when Phasic_Type='B' then S_${number}_MIN else 0 end) bMinValue
,sum(case when Phasic_Type='C' then S_${number}_MIN else 0 end) cMinValue
,sum(case when Phasic_Type='A' then S_${number}_CP95 else 0 end) aCP95Value
,sum(case when Phasic_Type='B' then S_${number}_CP95 else 0 end) bCP95Value
,sum(case when Phasic_Type='C' then S_${number}_CP95 else 0 end) cCP95Value from
<choose>
<when test="flagday == 1">
data_harmpower_s
</when>
<otherwise>
data_harmpower_s_take
</otherwise>
</choose>
where
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
and lineid = #{lineIndex}
group by timeid order by timeid asc
</select>
</mapper>

View File

@@ -0,0 +1,124 @@
<?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.dev_index devId,
T3.Status status,
T3.DevFlag devFlag,
T5.DIC_NAME company,
T8.DIC_NAME voltage,
T2.NAME lineName,
T2.line_index lineId,
T1.integrity integrity,
T9.dic_name devType
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,
PQS_DICDATA T9
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
AND T9.DIC_INDEX = T3.DEVTYPE
</select>
</mapper>

View File

@@ -0,0 +1,495 @@
<?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.LimitRateMapper'>
<resultMap type="LimitRate" id="limitRate" autoMapping="true">
<id column="PHASIC_TYPE" property="phasicType"/>
</resultMap>
<select id="getsteadyoutoflimit" resultType="ValueOfTargetanaly">
select sum(l.alltime) alltime, sum(l.flicket_alltime) fAllTime, NVL(sum(l.freq_dev_overtime),0) rate, NVL(sum(l.voltage_dev_overtime),0) deviationVol,
NVL(sum(l.ubalance_overtime),0) unbalanceVol, NVL(sum(l.flicker_overtime),0) flicker, NVL(sum(l.uaberrance_overtime),0) tHDU,
NVL(sum(l.uharm_2_overtime+l.uharm_4_overtime+l.uharm_6_overtime+l.uharm_8_overtime+l.uharm_10_overtime+l.uharm_12_overtime+l.uharm_14_overtime+l.uharm_16_overtime+l.uharm_18_overtime+l.uharm_20_overtime+l.uharm_22_overtime+l.uharm_24_overtime)/12,0) evenVol,
NVL(sum(l.uharm_3_overtime+l.uharm_5_overtime+l.uharm_7_overtime+l.uharm_9_overtime+l.uharm_11_overtime+l.uharm_13_overtime+l.uharm_15_overtime+l.uharm_17_overtime+l.uharm_19_overtime+l.uharm_21_overtime+l.uharm_23_overtime+l.uharm_25_overtime)/12,0) oddVol,
NVL(sum(l.iharm_2_overtime+l.iharm_4_overtime+l.iharm_6_overtime+l.iharm_8_overtime+l.iharm_10_overtime+l.iharm_12_overtime+l.iharm_14_overtime+l.iharm_16_overtime+l.iharm_18_overtime+l.iharm_20_overtime+l.iharm_22_overtime+l.iharm_24_overtime)/12,0) evenele,
NVL(sum(l.iharm_3_overtime+l.iharm_5_overtime+l.iharm_7_overtime+l.iharm_9_overtime+l.iharm_11_overtime+l.iharm_13_overtime+l.iharm_15_overtime+l.iharm_17_overtime+l.iharm_19_overtime+l.iharm_21_overtime+l.iharm_23_overtime+l.iharm_25_overtime)/12,0) oddele
from limit_rate l
where
l.myindex=#{lineIndex}
and l.timeid between #{startTime} and #{endTime}
</select>
<select id="getFrequencyDevitaion" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(Freq_Dev_OverTime) countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getUBalane" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(UBalance_OverTime) countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getUAberrance" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(UAberrance_OverTime) countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getVoltageDeviation" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(Voltage_Dev_OverTime) countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getFlicker" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(Flicket_AllTime) countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getOddVoltage" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(GREATEST
(UHarm_3_OverTime,UHarm_5_OverTime,UHarm_7_OverTime,UHarm_9_OverTime,UHarm_11_OverTime,UHarm_13_OverTime,UHarm_15_OverTime,UHarm_17_OverTime,UHarm_19_OverTime,UHarm_21_OverTime,UHarm_23_OverTime,UHarm_25_OverTime))
countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getEventVoltage" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(GREATEST
(UHarm_2_OverTime,UHarm_4_OverTime,UHarm_6_OverTime,UHarm_8_OverTime,UHarm_10_OverTime,UHarm_12_OverTime,UHarm_14_OverTime,UHarm_16_OverTime,UHarm_18_OverTime,UHarm_20_OverTime,UHarm_22_OverTime,UHarm_24_OverTime))
countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getOddElectric" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(GREATEST
(IHarm_3_OverTime,IHarm_5_OverTime,IHarm_7_OverTime,IHarm_9_OverTime,IHarm_11_OverTime,IHarm_13_OverTime,IHarm_15_OverTime,IHarm_17_OverTime,IHarm_19_OverTime,IHarm_21_OverTime,IHarm_23_OverTime,IHarm_25_OverTime))
countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getEventElectric" resultType="simpleValue">
SELECT
SUM(ALLTIME) countAll,
SUM(GREATEST
(IHarm_2_OverTime,IHarm_4_OverTime,IHarm_6_OverTime,IHarm_8_OverTime,IHarm_10_OverTime,IHarm_12_OverTime,IHarm_14_OverTime,IHarm_16_OverTime,IHarm_18_OverTime,IHarm_20_OverTime,IHarm_20_OverTime,IHarm_24_OverTime))
countOnline
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getsteadData" resultType="steadyData">
SELECT
SUM(ALLTIME) allTime,
SUM(Freq_Dev_OverTime) frequency,
SUM(
GREATEST (
IHarm_2_OverTime,
IHarm_4_OverTime,
IHarm_6_OverTime,
IHarm_8_OverTime,
IHarm_10_OverTime,
IHarm_12_OverTime,
IHarm_14_OverTime,
IHarm_16_OverTime,
IHarm_18_OverTime,
IHarm_20_OverTime,
IHarm_20_OverTime,
IHarm_24_OverTime
)
) evenElectric,
SUM(
GREATEST (
IHarm_3_OverTime,
IHarm_5_OverTime,
IHarm_7_OverTime,
IHarm_9_OverTime,
IHarm_11_OverTime,
IHarm_13_OverTime,
IHarm_15_OverTime,
IHarm_17_OverTime,
IHarm_19_OverTime,
IHarm_21_OverTime,
IHarm_23_OverTime,
IHarm_25_OverTime
)
) oddElectric,
SUM(
GREATEST (
UHarm_2_OverTime,
UHarm_4_OverTime,
UHarm_6_OverTime,
UHarm_8_OverTime,
UHarm_10_OverTime,
UHarm_12_OverTime,
UHarm_14_OverTime,
UHarm_16_OverTime,
UHarm_18_OverTime,
UHarm_20_OverTime,
UHarm_22_OverTime,
UHarm_24_OverTime
)
) evenVoltage,
SUM(
GREATEST (
UHarm_3_OverTime,
UHarm_5_OverTime,
UHarm_7_OverTime,
UHarm_9_OverTime,
UHarm_11_OverTime,
UHarm_13_OverTime,
UHarm_15_OverTime,
UHarm_17_OverTime,
UHarm_19_OverTime,
UHarm_21_OverTime,
UHarm_23_OverTime,
UHarm_25_OverTime
)
) oddVoltage,
SUM(Flicket_AllTime) flicker,
SUM(Voltage_Dev_OverTime) voltageDeviation,
SUM(UAberrance_OverTime) uAberrance,
SUM(UBalance_OverTime) uBalance
FROM
LIMIT_RATE
WHERE
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getSteadyDataByT" resultType="SteadyTable">
SELECT
T6.NAME powerCompany,
T7.NAME substation,
T3.NAME device,
T3.IP deviceIp,
T5.DIC_NAME company,
T8.DIC_NAME voltage,
T2.NAME lineName,
T1.line_index,
T1.harmElec,
T1.harmVoltage,
T1.voltageDeviation,
T1.flicker,
T1.frequency,
T1.uBalance,
T1.iNeg,
T1.inUharm
FROM
(
SELECT
MYINDEX line_index,
ROUND(
(
SUM( ALLTIME ) - SUM( GREATEST( IHarm_2_OverTime, IHarm_4_OverTime, IHarm_6_OverTime, IHarm_8_OverTime, IHarm_10_OverTime, IHarm_12_OverTime, IHarm_14_OverTime, IHarm_16_OverTime, IHarm_18_OverTime, IHarm_20_OverTime, IHarm_20_OverTime, IHarm_24_OverTime ,IHarm_3_OverTime, IHarm_5_OverTime, IHarm_7_OverTime, IHarm_9_OverTime, IHarm_11_OverTime, IHarm_13_OverTime, IHarm_15_OverTime, IHarm_17_OverTime, IHarm_19_OverTime, IHarm_21_OverTime, IHarm_23_OverTime, IHarm_25_OverTime ) )
) / SUM( ALLTIME ),
4
) * 100 harmElec,
ROUND(
(
SUM( ALLTIME ) - SUM( GREATEST( UHarm_2_OverTime, UHarm_4_OverTime, UHarm_6_OverTime, UHarm_8_OverTime, UHarm_10_OverTime, UHarm_12_OverTime, UHarm_14_OverTime, UHarm_16_OverTime, UHarm_18_OverTime, UHarm_20_OverTime, UHarm_22_OverTime, UHarm_24_OverTime,UHarm_3_OverTime, UHarm_5_OverTime, UHarm_7_OverTime, UHarm_9_OverTime, UHarm_11_OverTime, UHarm_13_OverTime, UHarm_15_OverTime, UHarm_17_OverTime, UHarm_19_OverTime, UHarm_21_OverTime, UHarm_23_OverTime, UHarm_25_OverTime ,UAberrance_OverTime) )
) / SUM( ALLTIME ),
4
) * 100 harmVoltage,
ROUND( ( SUM( ALLTIME ) - SUM( Freq_Dev_OverTime ) ) / SUM( ALLTIME ), 4 ) * 100 frequency,
ROUND( ( SUM( ALLTIME ) - SUM( UBalance_OverTime ) ) / SUM( ALLTIME ), 4 ) * 100 uBalance,
ROUND(
(
CASE
WHEN SUM( I_NEG_OVERTIME ) IS NULL THEN
1 ELSE ( SUM( ALLTIME ) - SUM( I_NEG_OVERTIME ) ) / SUM( ALLTIME )
END
),
4
) * 100 iNeg,
ROUND(
(
CASE
SUM( Flicket_AllTime )
WHEN 0 THEN
1 ELSE ( SUM( Flicket_AllTime ) - SUM( Flicker_OverTime ) ) / SUM( Flicket_AllTime )
END
),
4
) * 100 flicker,
ROUND( ( SUM( ALLTIME ) - SUM( Voltage_Dev_OverTime ) ) / SUM( ALLTIME ), 4 ) * 100 voltageDeviation,
ROUND(
(
CASE
WHEN SUM(
GREATEST(
INUHARM_1_OVERTIME,
INUHARM_2_OVERTIME,
INUHARM_3_OVERTIME,
INUHARM_4_OVERTIME,
INUHARM_5_OVERTIME,
INUHARM_6_OVERTIME,
INUHARM_7_OVERTIME,
INUHARM_8_OVERTIME,
INUHARM_9_OVERTIME,
INUHARM_10_OVERTIME,
INUHARM_11_OVERTIME,
INUHARM_12_OVERTIME,
INUHARM_13_OVERTIME,
INUHARM_14_OVERTIME,
INUHARM_15_OVERTIME,
INUHARM_16_OVERTIME
)
) IS NULL THEN
1 ELSE (
SUM( ALLTIME ) - SUM(
GREATEST(
INUHARM_1_OVERTIME,
INUHARM_2_OVERTIME,
INUHARM_3_OVERTIME,
INUHARM_4_OVERTIME,
INUHARM_5_OVERTIME,
INUHARM_6_OVERTIME,
INUHARM_7_OVERTIME,
INUHARM_8_OVERTIME,
INUHARM_9_OVERTIME,
INUHARM_10_OVERTIME,
INUHARM_11_OVERTIME,
INUHARM_12_OVERTIME,
INUHARM_13_OVERTIME,
INUHARM_14_OVERTIME,
INUHARM_15_OVERTIME,
INUHARM_16_OVERTIME
)
)
) / SUM( ALLTIME )
END
),
4
) * 100 inUharm
FROM
LIMIT_RATE
WHERE
PHASIC_TYPE = 'T'
and timeid between #{startTime} and #{endTime}
and myindex in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY
MYINDEX
) 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>
<select id="getsteadDataByT" resultType="SteadyData">
SELECT
SUM( ALLTIME ) ALLTIME,
SUM( FREQ_DEV_OVERTIME ) FREQUENCY,
SUM( UBALANCE_OVERTIME ) UBALANCE,
DECODE( SUM( I_NEG_OVERTIME ), NULL, 0, SUM( I_NEG_OVERTIME ) ) iNeg,
SUM( GREATEST( IHARM_2_OVERTIME, IHARM_4_OVERTIME, IHARM_6_OVERTIME, IHARM_8_OVERTIME, IHARM_10_OVERTIME, IHARM_12_OVERTIME, IHARM_14_OVERTIME, IHARM_16_OVERTIME, IHARM_18_OVERTIME, IHARM_20_OVERTIME, IHARM_20_OVERTIME, IHARM_24_OVERTIME,IHARM_3_OVERTIME, IHARM_5_OVERTIME, IHARM_7_OVERTIME, IHARM_9_OVERTIME, IHARM_11_OVERTIME, IHARM_13_OVERTIME, IHARM_15_OVERTIME, IHARM_17_OVERTIME, IHARM_19_OVERTIME, IHARM_21_OVERTIME, IHARM_23_OVERTIME, IHARM_25_OVERTIME ) ) harmElec,
SUM( GREATEST( UHARM_2_OVERTIME, UHARM_4_OVERTIME, UHARM_6_OVERTIME, UHARM_8_OVERTIME, UHARM_10_OVERTIME, UHARM_12_OVERTIME, UHARM_14_OVERTIME, UHARM_16_OVERTIME, UHARM_18_OVERTIME, UHARM_20_OVERTIME, UHARM_22_OVERTIME, UHARM_24_OVERTIME,UHARM_3_OVERTIME, UHARM_5_OVERTIME, UHARM_7_OVERTIME, UHARM_9_OVERTIME, UHARM_11_OVERTIME, UHARM_13_OVERTIME, UHARM_15_OVERTIME, UHARM_17_OVERTIME, UHARM_19_OVERTIME, UHARM_21_OVERTIME, UHARM_23_OVERTIME, UHARM_25_OVERTIME,UABERRANCE_OVERTIME ) ) harmVoltage,
SUM( FLICKER_OVERTIME ) FLICKER,
SUM( FLICKET_ALLTIME ) ALLFLICKER,
SUM( VOLTAGE_DEV_OVERTIME ) VOLTAGEDEVIATION,
DECODE(
SUM(
GREATEST(
INUHARM_1_OVERTIME,
INUHARM_2_OVERTIME,
INUHARM_3_OVERTIME,
INUHARM_4_OVERTIME,
INUHARM_5_OVERTIME,
INUHARM_6_OVERTIME,
INUHARM_7_OVERTIME,
INUHARM_8_OVERTIME,
INUHARM_9_OVERTIME,
INUHARM_10_OVERTIME,
INUHARM_11_OVERTIME,
INUHARM_12_OVERTIME,
INUHARM_13_OVERTIME,
INUHARM_14_OVERTIME,
INUHARM_15_OVERTIME,
INUHARM_16_OVERTIME
)
),
NULL,
0,
SUM(
GREATEST(
INUHARM_1_OVERTIME,
INUHARM_2_OVERTIME,
INUHARM_3_OVERTIME,
INUHARM_4_OVERTIME,
INUHARM_5_OVERTIME,
INUHARM_6_OVERTIME,
INUHARM_7_OVERTIME,
INUHARM_8_OVERTIME,
INUHARM_9_OVERTIME,
INUHARM_10_OVERTIME,
INUHARM_11_OVERTIME,
INUHARM_12_OVERTIME,
INUHARM_13_OVERTIME,
INUHARM_14_OVERTIME,
INUHARM_15_OVERTIME,
INUHARM_16_OVERTIME
)
)
) inUharm
FROM
LIMIT_RATE
WHERE
PHASIC_TYPE = 'T'
AND
MYINDEX IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
AND TIMEID BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getHarmonicRate" resultType="HarmonicRateInfo">
select nvl(t.harmonicRate, -1) harmonicRate,
t.line_index,
b.name pointName,
c.name bdName,
d.name gdName,
e.dic_name voltage,
f.ip ip
from (select nvl(m.harmonicRate, -1) harmonicRate, n.line_index line_index
from (select a.lineid lineid,
nvl(max(a.v_thd_cp95), -1) harmonicRate
from day_v a
where a.lineid in
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
and a.timeid BETWEEN #{start} AND #{end}
group by a.lineid
order by harmonicRate desc) m
right join pq_line n
on m.lineid = n.line_index where n.line_index in
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
) t,
pq_line b,
pq_substation c,
pq_gdinformation d,
pqs_dicdata e,
pq_device f
where t.line_index = b.line_index
and b.sub_index = c.sub_index
and b.gd_index = d.gd_index
and b.scale = e.dic_index
and b.dev_index = f.dev_index
</select>
<select id="queryData" resultType="limitRate">
SELECT
*
FROM
limit_rate T1
WHERE
T1.TIMEID BETWEEN to_date(#{startTime}, 'yyyy-MM-dd Hh24:mi::ss')
AND to_date(#{endTime}, 'yyyy-MM-dd Hh24:mi::ss')
AND T1.MYINDEX = #{lineIndex}
</select>
</mapper>

View File

@@ -0,0 +1,19 @@
<?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.OfflLogMapper'>
<select id="getYearByGd" resultType="String">
select distinct a.year
from offl_log a, pq_line b
where a.year is not null and a.line_index = b.line_index
and b.line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by year asc">
#{item}
</foreach>
</select>
<select id="getSETimeByIndex" resultType="offlLog">
select start_time startTime,end_time endTime,year from offl_log where line_index = #{lineIndex} order by startTime asc
</select>
</mapper>

View File

@@ -0,0 +1,93 @@
<?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.log.UserLogDetailMapper">
<!-- 日志 -->
<resultMap type="com.njcn.pojo.log.UserLogDetail" id="UserLogDetailMapperMap" autoMapping="true">
</resultMap>
<!-- 查询所有日志 -->
<select id="getUserLog" resultMap="UserLogDetailMapperMap">
select t.dictype_name as type,
a.dic_name as name,
u.USERLOG_DESCRIBE as userlogDescribe,
u.updatetime as updatetime,
u.ip as ip,
decode(a.DIC_LEAVE, 0, '普通', 1, '中等',2,'严重') as leval
from pqs_userlog u ,
pqs_dicdata a ,
pqs_dictype t
where u.type=a.dic_index
and a.dic_type=t.dictype_index
order by u.updatetime desc
</select>
<!-- 根据条件查询所有日志 -->
<select id="getUserLogId" resultMap="UserLogDetailMapperMap">
select t.dictype_name as type,
a.dic_name as name,
u.USERLOG_DESCRIBE as userlogDescribe,
u.updatetime as updatetime,
u.ip as ip,
decode(a.DIC_LEAVE, 0, '普通', 1, '中等',2,'严重') as leval
from pqs_userlog u ,
pqs_dicdata a ,
pqs_dictype t
where u.type=a.dic_index
and a.dic_type=t.dictype_index
and t.dictype_index like #{type}
and a.dic_index like #{name}
and to_number(to_char(u.updatetime, 'yyyyMMddHHmiss')) between #{startTime}
and #{endTime}
order by u.updatetime desc
</select>
<!-- 统计事件类型 -->
<select id="geteventtype" resultMap="UserLogDetailMapperMap">
select t.dictype_name as type,
count(1) as num
from pqs_userlog u ,
pqs_dicdata a ,
pqs_dictype t
where u.type=a.dic_index
and a.dic_type=t.dictype_index
and to_number(to_char(u.updatetime, 'yyyyMMddHHmmss')) between #{startTime}
and #{endTime}
group by t.dictype_name
</select>
<!-- 统计详细事件 -->
<select id="getdetailtype" resultMap="UserLogDetailMapperMap">
select a.dic_name as name,
count(1) as num
from pqs_userlog u ,
pqs_dicdata a ,
pqs_dictype t
where u.type=a.dic_index
and a.dic_type=t.dictype_index
and to_number(to_char(u.updatetime, 'yyyyMMddHHmmss')) between #{startTime}
and #{endTime}
group by a.dic_name
</select>
<!-- 统计用户统计 -->
<select id="getUserStatistics" resultMap="UserLogDetailMapperMap">
select b.loginname name,
count(1) num
from pqs_userlog a,
pqs_user b
where A.USERLOG_DESCRIBE like '%'||b.loginname||'%'
and a.user_index=b.user_index
and to_number(to_char(a.updatetime, 'yyyyMMddHHmmss')) between #{startTime}
and #{endTime}
group by b.loginname
</select>
<delete id="delExpireLog" databaseId="Oracle">
delete from pqs_userlog
where rowid = (select rowid
from (select UPDATETIME from pqs_userlog where UPDATETIME &lt; #{endTime} order by UPDATETIME)
where rownum = 1)
</delete>
<delete id="delExpireLog" databaseId="MariaDB">
delete from pqs_userlog
where UPDATETIME = (select UPDATETIME from pqs_userlog where UPDATETIME &lt; #{endTime} order by UPDATETIME LIMIT 1 )
</delete>
</mapper>

View File

@@ -0,0 +1,35 @@
<?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.log.UserLoginMapper">
<!-- 日志 -->
<resultMap type="com.njcn.pojo.log.UserLogin" id="UserLoginMapperMap" autoMapping="true">
</resultMap>
<!-- 查询所有登录信息 -->
<select id="getUserLogin" resultMap="UserLoginMapperMap">
SELECT
*
FROM
pqs_userlogin ul,
pqs_user U
WHERE
ul.user_index = U .user_index
AND TO_NUMBER (
TO_CHAR (
ul.loginTime,
'yyyyMMddHHmiss'
)
) BETWEEN # { startTime }
AND # { endTime }
ORDER BY
ul.loginTime DESC
</select>
<select id="getLastedLogin" resultType="userLogin" databaseId="MariaDB">
SELECT * FROM (SELECT * FROM PQS_USERLOGIN WHERE USER_INDEX=#{userIndex} ORDER BY LOGINTIME DESC) a limit 1
</select>
<select id="getLastedLogin" resultType="userLogin" databaseId="Oracle">
SELECT * FROM (SELECT * FROM PQS_USERLOGIN WHERE USER_INDEX=#{userIndex} ORDER BY LOGINTIME DESC) where ROWNUM = 1
</select>
</mapper>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
<?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.plate.PlateReportDataMapper'>
<select id="getYGDNMonthValue" resultType="PlateReportData">
SELECT TIMEID timeId, sum( CASE WHEN rate = #{rateA} THEN ${syllableName} ELSE 0 END ) trorseValue,
sum( CASE WHEN rate = #{rateB} THEN ${syllableName} ELSE 0 END ) retrorseValue,
sum( CASE WHEN rate = #{rateC} THEN ${syllableName} ELSE 0 END ) composeValue,
sum( CASE WHEN rate = #{rateD} THEN ${syllableName} ELSE 0 END ) oneQuadrantValue
FROM
PLATE_REPORT
WHERE
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
AND lineid = #{ lineIndex }
AND phasic_type = 'T'
GROUP BY
timeid
ORDER BY
timeid ASC
</select>
<select id="getYGDNYearValue" resultType="PlateReportData">
SELECT to_char(TIMEID,'yyyy-mm') timeId, sum( CASE WHEN rate = #{rateA} THEN ${syllableName} ELSE 0 END ) trorseValue,
sum( CASE WHEN rate = #{rateB} THEN ${syllableName} ELSE 0 END ) retrorseValue,
sum( CASE WHEN rate = #{rateC} THEN ${syllableName} ELSE 0 END ) composeValue,
sum( CASE WHEN rate = #{rateD} THEN ${syllableName} ELSE 0 END ) oneQuadrantValue
FROM
PLATE_REPORT
WHERE
<if test="_databaseId == 'MariaDB'">
DATE_FORMAT(timeid,'%Y-%m-%d %H:%i:%s') between concat(#{startTime},' ',#{start}) and
concat(#{endTime},' ',#{end})
</if>
<if test="_databaseId == 'Oracle'">
timeid between to_date(#{startTime},'yyyy-mm-DD hh24:mi:ss') and to_date(#{endTime},'yyyy-mm-DD hh24:mi:ss')
</if>
AND lineid = #{ lineIndex }
AND phasic_type = 'T'
GROUP BY
to_char(TIMEID,'yyyy-mm')
ORDER BY
timeid ASC
</select>
</mapper>

View File

@@ -0,0 +1,103 @@
<?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.pqs9000.mapper.monitorMap.MonitorScopeMapper">
<select id="getMonitorScope" resultType="AreaSubLineVO">
select
gg.lineId,
gg.pt1 pt1,
gg.pt2 pt2,
gg.ct1 ct1,
gg.ct2 ct2,
gg.lineName,
gg.devflag runFlag,
gg.status comFlag,
gg.hang_Line,
gg.wiringDiagram,
gg.voltageLevel,
gg.ip,
gg.busBarName,
gg.busBarId,
gg.subName,
gg.lng,
gg.lat,
gg.manufacturer,
nvl(hh.eventCount,0) eventCount
from (
SELECT
a.line_index lineId,
a.pt1 pt1,
a.pt2 pt2,
a.ct1 ct1,
a.ct2 ct2,
a.name lineName,
f.hang_Line,
f.wiring_diagram wiringDiagram,
b.dic_name voltageLevel,
c.ip ip,
c.devflag,
c.status,
d.name busBarName,
d.SUBV_INDEX busBarId,
e.name subName,
g.LONGITUDE lng,
g.LATITUDE lat,
h.dic_name manufacturer
FROM
pq_line a,
pqs_dicdata b,
pq_device c,
pq_subvoltage d,
pq_substation e,
pq_linedetail f,
pqs_map g,
pqs_dicdata h,
pq_devicedetail i
WHERE b.dic_index = a.scale
and a.dev_index = c.dev_index
and c.dev_index = i.dev_index
and d.subv_index = a.subv_index
and e.sub_index = a.sub_index
and a.line_index = f.line_index
and e.sub_index = g.sub_index
and h.dic_index = i.MANUFACTURER
AND a.line_index in
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
) gg
left join
(
select count(1) eventCount ,LINEID from PQS_EVENTDETAIL
where TIMEID between #{startTime}
AND #{endTime}
AND LINEID in
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by LINEID
) hh on gg.lineId = hh.LINEID
</select>
<select id="getAreaLineEventCount" resultType="int">
select count(1) from pq_line a
left join pq_device b on a.dev_index = b.dev_index
where b.status = 1
and a.line_index in
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getEventCount" resultType="int">
select count(1) from PQS_EVENTDETAIL
where TIMEID between #{startTime} and #{endTime}
and LINEID in
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,226 @@
<?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.point.PointBaseInfoMapper">
<select id="getPointInfo" resultType="PointInfo">
SELECT a.pt1 pt1,
a.pt2 pt2,
a.ct1 ct1,
a.ct2 ct2,
a.devcmp devcmp,
a.name name,
a.dlcmp dlcmp,
a.jzcmp jzcmp,
a.xycmp xycmp,
f.objname objName,
f.superiors_Substation,
f.hang_Line,
f.owner,
f.owner_Duty,
f.owner_Tel,
f.wiring_diagram wiringDiagram,
b.dic_name voltageClasses,
c.ip ip,
c.logontime loginDate,
c.status iState,
(select t1.dic_name
from pqs_dicdata t1, pq_devicedetail t2, pq_line t3
where t1.dic_index = t2.manufacturer
and t3.dev_index = t2.dev_index
and t3.line_index = #{pointIndex}) factory,
(select tt1.dic_name
from pqs_dicdata tt1, pq_device tt2, pq_line tt3
where tt1.dic_index = tt2.devtype
and tt3.dev_index = tt2.dev_index
and tt3.line_index = #{pointIndex}) devType,
(select a.dic_name
from pqs_dicdata a, pq_linedetail b
where a.dic_index = b.loadtype
and b.line_index = #{pointIndex}) loadType,
(select a.dic_name
from pqs_dicdata a, pq_linedetail b
where a.dic_index = b.CLASSIFICATION_GRADE
and b.line_index = #{pointIndex}) as calssificationGrade,
(select a.dic_name
from pqs_dicdata a, pq_linedetail b
where a.dic_index = b.BUSINESSTYPE
and b.line_index = #{pointIndex}) businessType,
d.name pName,
e.name bdName
FROM pq_line a,
pqs_dicdata b,
pq_device c,
pq_subvoltage d,
pq_substation e,
pq_linedetail f
WHERE b.dic_index = a.scale
and a.dev_index = c.dev_index
and d.subv_index = a.subv_index
and e.sub_index = a.sub_index
and a.line_index = f.line_index
AND a.line_index = #{pointIndex}
</select>
<select id="getFlowInfo" resultType="PointInfo">
SELECT nvl(fm.fm_number,
nvl((select FM_NUMBER
from PQS_FLOWMEAL
where type = 0
and SECOND_TYPE = 0),
0)) as baseFlow,
nvl(fm2.fm_number, 0) as extendFlow,
nvl((SELECT af.actualflow
FROM PQS_MONTHFLOW af
WHERE af.DEV_INDEX = pq.DEV_INDEX
and to_char(af.timeid, 'yyyy-MM') =
to_char(sysdate, 'yyyy-MM')),
0) / nullif(((nvl(fm.fm_number,
nvl((select FM_NUMBER
from PQS_FLOWMEAL
where type = 0
and SECOND_TYPE = 0),
0))) + (nvl(fm2.fm_number, 0))) * 1024 * 1024,
0) as useFlow
FROM PQ_DEVICE pq
left join PQS_DEVEDASS ded
on pq.DEV_INDEX = ded.DEV_INDEX
and ded.STATE = 1
and ded.UPDATERESULT = 1
left join PQS_EDDATA ed
on ded.ED_INDEX = ed.ED_INDEX
left join PQS_DEVFMASS dm
on pq.DEV_INDEX = dm.DEV_INDEX
left join PQS_FLOWMEAL fm
on dm.FM_BASE_INDEX = fm.FM_INDEX
left join PQS_FLOWMEAL fm2
on dm.FM_REAM_INDEX = fm2.FM_INDEX
WHERE pq.DEVMODEL = 1
and pq.dev_index =
(select dev_index from pq_line where line_index = #{pointIndex})
</select>
<select id="getOverLimit" resultType="map">
select * from overlimit where myindex = #{pointIndex}
</select>
<select id="getLineLedger" resultType="com.njcn.pojo.pointInfo.LineLedger">
SELECT
j.dic_name province,
a.line_index lineIndex,
mod(a.line_index,10) as lineNum,
a.name lineName,
a.dev_index devIndex,
a.status lineStatus,
b.pttype ptType,
b.POWERID powerId,
b.MONITOR_ID monitorId,
a.devcmp devCmp,
a.dlcmp dlCmp,
a.xycmp xyCmp,
b.objname objName,
nvl(b.POWER_SUBSTATION_NAME,e.name) as powerSubstationName,
g.dic_name scale,
h.dic_name loadType,
d.name devName,
d.updateTime updateTime,
d.status,
e.name subName,
f.name gdName,
c.freq_dev freqDev,
c.voltage_dev voltageDev,
c.uvoltage_dev uVoltageDev,
c.ubalance uBalance,
c.flicker,
c.uaberrance aberrance,
c.i_neg iNeg,
c.iharm_2 iharm2,
c.iharm_3 iharm3,
c.iharm_4 iharm4,
c.iharm_5 iharm5,
c.iharm_6 iharm6,
c.iharm_7 iharm7,
c.iharm_8 iharm8,
c.iharm_9 iharm9,
c.iharm_10 iharm10,
c.iharm_11 iharm11,
c.iharm_12 iharm12,
c.iharm_13 iharm13,
c.iharm_14 iharm14,
c.iharm_15 iharm15,
c.iharm_16 iharm16,
c.iharm_17 iharm17,
c.iharm_18 iharm18,
c.iharm_19 iharm19,
c.iharm_20 iharm20,
c.iharm_21 iharm21,
c.iharm_22 iharm22,
c.iharm_23 iharm23,
c.iharm_24 iharm24,
c.iharm_25 iharm25,
c.uharm_2 uharm2,
c.uharm_3 uharm3,
c.inuharm_3 inuharmAll,
c.inuharm_2 inuharm2,
k.NODE_NAME nodeName
FROM
pq_line a
LEFT JOIN pq_linedetail b ON a.line_index = b.line_index
LEFT JOIN overlimit c ON a.line_index = myindex
LEFT JOIN pq_device d ON a.dev_index = d.dev_index
LEFT JOIN pq_substation e ON a.sub_index = e.sub_index
LEFT JOIN pq_gdinformation f ON a.gd_index = f.gd_index
LEFT JOIN pqs_dicdata g ON a.scale = g.dic_index
LEFT JOIN pqs_dicdata h ON b.loadtype = h.dic_index
LEFT JOIN pq_province i ON f.province_index = i.province_index
LEFT JOIN pqs_dicdata j ON i.name = j.dic_index
LEFT JOIN NODEINFORMATION k ON d.NODE_INDEX = k.NODE_INDEX
where a.line_index in
<foreach collection="lineList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="loadTypeList!=null">
and h.dic_index in
<foreach collection="loadTypeList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="scaleList!=null">
and g.dic_index in
<foreach collection="scaleList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="status!=null">
and d.status = #{status}
</if>
<choose>
<when test="type == 0"> and b.MONITOR_ID is not null and b.MONITOR_ID != ' '</when>
<when test="type == 1"> and (b.MONITOR_ID IS NULL or b.MONITOR_ID IN (' '))</when>
</choose>
</select>
<select id="getDeptsLineIndex" resultType="java.lang.Integer"
databaseId="Oracle">
select distinct (a.line_index)
from pqs_deptsline a,
pq_device b, pq_line c
where a.depts_index in
(select depts_index
from
pqs_depts
start with parentnodeid = #{deptsIndex}
connect by prior
depts_index = parentnodeid)
and a.systype = #{sysIndex}
and c.line_index = a.line_index
and c.dev_index = b.dev_index
and b.devmodel = 1
</select>
<select id="lineUnitDetail" resultType="DeviceUnitVO">
select c.*,a.line_index as lineId
from pq_line a inner join
pq_device b on a.dev_index = b.dev_index
left join pqs_device_unit c on b.dev_index = c.dev_index
where a.line_index = #{lineId}
</select>
</mapper>

View File

@@ -0,0 +1,279 @@
<?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.pqs9000.mapper.report.ExcelReportMapper">
<select id="getDatasByPloy" resultType="RptData">
select * from PQS_RPTDATA t2 where T2.RD_INDEX in(
select T1.RD_INDEX from PQS_RPTASS t1 where T1.RP_INDEX = #{guid}
)
</select>
<select id="getDatas" parameterType="java.util.Set" resultType="RptData">
select * from pqs_rptdata where rd_index in
<foreach collection="sets" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="integrityDataByIndex" resultType="fpyReportData">
SELECT
T7. NAME bdName,
T8.DIC_NAME scale,
T2.NAME lineName,
T1.integrity integrity,
T2.PT1 || '/' || T2.PT2 pt,
T2.CT1 || '/' || T2.CT2 ct,
T2.dlcmp,
T2.devcmp,
T2.xycmp
FROM
(
SELECT
T1.LINE_INDEX,
ROUND (
SUM (T1.REAL) / (
SUM (T1.DUE)
),
4
) * 100 integrity
FROM
PQS_Integrity T1
WHERE
T1.LINE_INDEX = #{lineIndex}
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>
<select id="getExportDev" resultType="com.njcn.pojo.commons.device.ExportDev">
SELECT DISTINCT
q.name as projname,
j.dic_name proname,
c.name gdname,
h.deptsname,
d.name subName,
k.dic_name scale,
l.longitude,
l.latitude,
b.name devname,
b.ip,
n.dic_name manufacturer,
decode(b.devmodel, 0, '虚拟终端', 1, '实际终端', '离线终端') as devmodel,
o.dic_name devtype,
p.node_name nodename,
b.portid,
nvl(b.dev_series, '') as series,
nvl(b.dev_key, '') as keym,
e.name as subvname,
e.subv_num as subvnum,
a.name as linename,
substr(a.line_index, length(a.line_index), 1) as linenum,
(a.pt1 || '/' || a.pt2) as pt,
(a.ct1 || '/' || a.ct2) as ct,
a.dlcMp as dlrl,
a.devcMp as sbrl,
a.xycMp as xyrl
FROM
pq_line a
INNER JOIN pq_device b ON a.dev_index = b.dev_index
INNER JOIN PQ_GDINFORMATION c ON a.gd_index = c.gd_index
INNER JOIN pq_substation d ON a.sub_index = d.sub_index
INNER JOIN PQ_SUBVOLTAGE e ON a.subv_index = e.subv_index
INNER JOIN pq_linedetail f ON a.line_index = f.line_index
INNER JOIN pqs_deptsline g ON a.line_index = g.line_index
INNER JOIN pqs_depts h ON g.depts_index = h.depts_index and h.state = 1
INNER JOIN PQ_PROVINCE i ON c.province_index = i.province_index
INNER JOIN pqs_dicdata j ON i.name = j.dic_index
LEFT JOIN pqs_dicdata k ON d.scale = k.dic_index
LEFT join pqs_map l on d.sub_index = l.sub_index and l.state = 1
INNER join PQ_DEVICEDETAIL m on b.dev_index=m.dev_index
LEFT join PQS_DICDATA n on m.manufacturer = n.DIC_INDEX
LEFT join PQS_DICDATA o on b.devtype=o.dic_index
INNER join NODEINFORMATION p on b.node_index=p.node_index
INNER JOIN pq_project q on i.project_index = q.project_index
WHERE g.systype = #{sysType}
and b.devmodel = 1
and a.line_index in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="runProc" statementType="CALLABLE" resultType="map">
<![CDATA[
{
call DAY_REPORT_PROCESS_DATE_SL(
#{LineNo,mode=IN, jdbcType=INTEGER},
#{startTime,mode=IN},
#{endTime,mode=IN})
}
]]>
</select>
<select id="getIntegrityList" resultType="LineBaseData">
select
ROUND(sum(REAL)/sum(DUE),2) as value,line_index as lineId
from PQS_INTEGRITY
where LINE_INDEX in
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and TIMEID between #{startTime} and #{endTime}
group by LINE_INDEX
</select>
<select id="getLimitRateData" resultType="map">
select MYINDEX MYINDEX,
SUM( UHARM_2_OVERTIME ) UHARM_2_OVERTIME,
SUM( IHARM_2_OVERTIME ) IHARM_2_OVERTIME,
SUM( UHARM_3_OVERTIME ) UHARM_3_OVERTIME,
SUM( IHARM_3_OVERTIME ) IHARM_3_OVERTIME,
SUM( UHARM_4_OVERTIME ) UHARM_4_OVERTIME,
SUM( IHARM_4_OVERTIME ) IHARM_4_OVERTIME,
SUM( UHARM_5_OVERTIME ) UHARM_5_OVERTIME,
SUM( IHARM_5_OVERTIME ) IHARM_5_OVERTIME,
SUM( UHARM_6_OVERTIME ) UHARM_6_OVERTIME,
SUM( IHARM_6_OVERTIME ) IHARM_6_OVERTIME,
SUM( UHARM_7_OVERTIME ) UHARM_7_OVERTIME,
SUM( IHARM_7_OVERTIME ) IHARM_7_OVERTIME,
SUM( UHARM_8_OVERTIME ) UHARM_8_OVERTIME,
SUM( IHARM_8_OVERTIME ) IHARM_8_OVERTIME,
SUM( UHARM_9_OVERTIME ) UHARM_9_OVERTIME,
SUM( IHARM_9_OVERTIME ) IHARM_9_OVERTIME,
SUM( UHARM_10_OVERTIME ) UHARM_10_OVERTIME,
SUM( IHARM_10_OVERTIME ) IHARM_10_OVERTIME,
SUM( UHARM_11_OVERTIME ) UHARM_11_OVERTIME,
SUM( IHARM_11_OVERTIME ) IHARM_11_OVERTIME,
SUM( UHARM_12_OVERTIME ) UHARM_12_OVERTIME,
SUM( IHARM_12_OVERTIME ) IHARM_12_OVERTIME,
SUM( UHARM_13_OVERTIME ) UHARM_13_OVERTIME,
SUM( IHARM_13_OVERTIME ) IHARM_13_OVERTIME,
SUM( UHARM_14_OVERTIME ) UHARM_14_OVERTIME,
SUM( IHARM_14_OVERTIME ) IHARM_14_OVERTIME,
SUM( UHARM_15_OVERTIME ) UHARM_15_OVERTIME,
SUM( IHARM_15_OVERTIME ) IHARM_15_OVERTIME,
SUM( UHARM_16_OVERTIME ) UHARM_16_OVERTIME,
SUM( IHARM_16_OVERTIME ) IHARM_16_OVERTIME,
SUM( UHARM_17_OVERTIME ) UHARM_17_OVERTIME,
SUM( IHARM_17_OVERTIME ) IHARM_17_OVERTIME,
SUM( UHARM_18_OVERTIME ) UHARM_18_OVERTIME,
SUM( IHARM_18_OVERTIME ) IHARM_18_OVERTIME,
SUM( UHARM_19_OVERTIME ) UHARM_19_OVERTIME,
SUM( IHARM_19_OVERTIME ) IHARM_19_OVERTIME,
SUM( UHARM_20_OVERTIME ) UHARM_20_OVERTIME,
SUM( IHARM_20_OVERTIME ) IHARM_20_OVERTIME,
SUM( UHARM_21_OVERTIME ) UHARM_21_OVERTIME,
SUM( IHARM_21_OVERTIME ) IHARM_21_OVERTIME,
SUM( UHARM_22_OVERTIME ) UHARM_22_OVERTIME,
SUM( IHARM_22_OVERTIME ) IHARM_22_OVERTIME,
SUM( UHARM_23_OVERTIME ) UHARM_23_OVERTIME,
SUM( IHARM_23_OVERTIME ) IHARM_23_OVERTIME,
SUM( UHARM_24_OVERTIME ) UHARM_24_OVERTIME,
SUM( IHARM_24_OVERTIME ) IHARM_24_OVERTIME,
SUM( UHARM_25_OVERTIME ) UHARM_25_OVERTIME,
SUM( IHARM_25_OVERTIME ) IHARM_25_OVERTIME,
SUM( VOLTAGE_DEV_OVERTIME ) VOLTAGE_DEV_OVERTIME,
SUM( UABERRANCE_OVERTIME ) UABERRANCE_OVERTIME,
SUM( UBALANCE_OVERTIME ) UBALANCE_OVERTIME,
SUM( FLICKER_OVERTIME ) FLICKER_OVERTIME,
SUM( FLICKET_ALLTIME ) FLICKET_ALLTIME,
sum( Freq_Dev_OverTime ) FREQ_DEV_OVERTIME,
SUM( ALLTIME ) ALLTIME
FROM
LIMIT_RATE
WHERE
MYINDEX in
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and timeid BETWEEN #{startTime} AND #{endTime}
AND Phasic_Type = 'T'
group by MYINDEX
</select>
<select id="getLimitRateDataIHarm" resultType="map">
select LINEID MYINDEX,
max( I_2 ) IHARM_2_OVERTIME,
max( I_3 ) IHARM_3_OVERTIME,
max( I_4 ) IHARM_4_OVERTIME,
max( I_5 ) IHARM_5_OVERTIME,
max( I_6 ) IHARM_6_OVERTIME,
max( I_7 ) IHARM_7_OVERTIME,
max( I_8 ) IHARM_8_OVERTIME,
max( I_9 ) IHARM_9_OVERTIME,
max( I_10 ) IHARM_10_OVERTIME,
max( I_11 ) IHARM_11_OVERTIME,
max( I_12 ) IHARM_12_OVERTIME,
max( I_13 ) IHARM_13_OVERTIME,
max( I_14 ) IHARM_14_OVERTIME,
max( I_15 ) IHARM_15_OVERTIME,
max( I_16 ) IHARM_16_OVERTIME,
max( I_17 ) IHARM_17_OVERTIME,
max( I_18 ) IHARM_18_OVERTIME,
max( I_19 ) IHARM_19_OVERTIME,
max( I_20 ) IHARM_20_OVERTIME,
max( I_21 ) IHARM_21_OVERTIME,
max( I_22 ) IHARM_22_OVERTIME,
max( I_23 ) IHARM_23_OVERTIME,
max( I_24 ) IHARM_24_OVERTIME,
max( I_25 ) IHARM_25_OVERTIME
FROM
DAY_I
WHERE
LINEID in
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and timeid BETWEEN #{startTime} AND #{endTime}
group by LINEID
</select>
<select id="getLineBaseInfo" resultType="FpyReportData">
select
pq_line.LINE_INDEX lineIndex,
pq_line.name lineName,
concat( concat(pq_line.ct1, '/'), pq_line.ct2 ) AS ct,
concat( concat(pq_line.pt1, '/'), pq_line.pt2 ) AS pt,
PQ_SUBSTATION.name bdName,
pq_line.DEVCMP devcmp,
pq_line.DLCMP dlcmp,
pq_line.xycmp xycmp,
PQS_DICDATA.DIC_NAME scale,
grade.dic_name calssificationGrade,
business.dic_name businessType,
PQ_LINEDETAIL.SUPERIORS_SUBSTATION,
PQ_LINEDETAIL.HANG_LINE
from pq_line pq_line
inner join PQ_LINEDETAIL PQ_LINEDETAIL on pq_line.LINE_INDEX = PQ_LINEDETAIL.LINE_INDEX
inner join PQ_SUBSTATION PQ_SUBSTATION on pq_line.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
inner join PQS_DICDATA PQS_DICDATA on pq_line.SCALE = PQS_DICDATA.DIC_INDEX
left join PQS_DICDATA grade on PQ_LINEDETAIL.CLASSIFICATION_GRADE = grade.DIC_INDEX
left join PQS_DICDATA business on PQ_LINEDETAIL.BUSINESSTYPE = business.DIC_INDEX
where pq_line.LINE_INDEX in
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,58 @@
<?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.pqs9000.mapper.report.GetDistortionDataMapper">
<select id="getDistortionDataV" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE,MAX(V_THD_MAX) FMAXVALUE,MIN(V_THD_MIN) MINVALUE,ROUND(AVG(V_THD) ,2)
MEANVALUE,MAX(CASE WHEN VTHDCP95 =#{condition.count} THEN V_THD ELSE NULL END)
CP95VALUE FROM ( SELECT T.*,ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY V_THD DESC) VTHDCP95
from
<choose>
<when test="condition.b == true">
Data_V
</when>
<otherwise>
Day_V
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getDistortionDataI" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE,MAX(I_THD_MAX) FMAXVALUE,MIN(I_THD_MIN) MINVALUE,ROUND(AVG(I_THD) ,2)
MEANVALUE,MAX(CASE WHEN ITHDCP95 =#{condition.count} THEN I_THD ELSE NULL END)
CP95VALUE FROM ( SELECT T.*,ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY I_THD DESC) ITHDCP95
from
<choose>
<when test="condition.b == true">
Data_I
</when>
<otherwise>
Day_I
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getHDistortionData" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE,V_THD_MAX FMAXVALUE,V_THD_MIN MINVALUE,V_THD MEANVALUE,V_THD_CP95 CP95VALUE,TIMEID
from day_v where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
</select>
</mapper>

View File

@@ -0,0 +1,59 @@
<?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.pqs9000.mapper.report.GetFpyMapper">
<select id="getFpy" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
<choose>
<when test="flag != 2">
SUM(UHARM_2_OVERTIME) UHARM_2_OVERTIME,SUM(IHARM_2_OVERTIME) IHARM_2_OVERTIME,
SUM(UHARM_3_OVERTIME) UHARM_3_OVERTIME,SUM(IHARM_3_OVERTIME) IHARM_3_OVERTIME,
SUM(UHARM_4_OVERTIME) UHARM_4_OVERTIME,SUM(IHARM_4_OVERTIME) IHARM_4_OVERTIME,
SUM(UHARM_5_OVERTIME) UHARM_5_OVERTIME,SUM(IHARM_5_OVERTIME) IHARM_5_OVERTIME,
SUM(UHARM_6_OVERTIME) UHARM_6_OVERTIME,SUM(IHARM_6_OVERTIME) IHARM_6_OVERTIME,
SUM(UHARM_7_OVERTIME) UHARM_7_OVERTIME,SUM(IHARM_7_OVERTIME) IHARM_7_OVERTIME,
SUM(UHARM_8_OVERTIME) UHARM_8_OVERTIME,SUM(IHARM_8_OVERTIME) IHARM_8_OVERTIME,
SUM(UHARM_9_OVERTIME) UHARM_9_OVERTIME,SUM(IHARM_9_OVERTIME) IHARM_9_OVERTIME,
SUM(UHARM_10_OVERTIME) UHARM_10_OVERTIME,SUM(IHARM_10_OVERTIME) IHARM_10_OVERTIME,
SUM(UHARM_11_OVERTIME) UHARM_11_OVERTIME,SUM(IHARM_11_OVERTIME) IHARM_11_OVERTIME,
SUM(UHARM_12_OVERTIME) UHARM_12_OVERTIME,SUM(IHARM_12_OVERTIME) IHARM_12_OVERTIME,
SUM(UHARM_13_OVERTIME) UHARM_13_OVERTIME,SUM(IHARM_13_OVERTIME) IHARM_13_OVERTIME,
SUM(UHARM_14_OVERTIME) UHARM_14_OVERTIME,SUM(IHARM_14_OVERTIME) IHARM_14_OVERTIME,
SUM(UHARM_15_OVERTIME) UHARM_15_OVERTIME,SUM(IHARM_15_OVERTIME) IHARM_15_OVERTIME,
SUM(UHARM_16_OVERTIME) UHARM_16_OVERTIME,SUM(IHARM_16_OVERTIME) IHARM_16_OVERTIME,
SUM(UHARM_17_OVERTIME) UHARM_17_OVERTIME,SUM(IHARM_17_OVERTIME) IHARM_17_OVERTIME,
SUM(UHARM_18_OVERTIME) UHARM_18_OVERTIME,SUM(IHARM_18_OVERTIME) IHARM_18_OVERTIME,
SUM(UHARM_19_OVERTIME) UHARM_19_OVERTIME,SUM(IHARM_19_OVERTIME) IHARM_19_OVERTIME,
SUM(UHARM_20_OVERTIME) UHARM_20_OVERTIME,SUM(IHARM_20_OVERTIME) IHARM_20_OVERTIME,
SUM(UHARM_21_OVERTIME) UHARM_21_OVERTIME,SUM(IHARM_21_OVERTIME) IHARM_21_OVERTIME,
SUM(UHARM_22_OVERTIME) UHARM_22_OVERTIME,SUM(IHARM_22_OVERTIME) IHARM_22_OVERTIME,
SUM(UHARM_23_OVERTIME) UHARM_23_OVERTIME,SUM(IHARM_23_OVERTIME) IHARM_23_OVERTIME,
SUM(UHARM_24_OVERTIME) UHARM_24_OVERTIME,SUM(IHARM_24_OVERTIME) IHARM_24_OVERTIME,
SUM(UHARM_25_OVERTIME) UHARM_25_OVERTIME,SUM(IHARM_25_OVERTIME) IHARM_25_OVERTIME,
SUM(VOLTAGE_DEV_OVERTIME) VOLTAGE_DEV_OVERTIME,
SUM(UABERRANCE_OVERTIME) UABERRANCE_OVERTIME,
SUM(FLICKER_OVERTIME) FLICKER_OVERTIME,
SUM(ALLTIME) ALLTIME,
SUM(FLICKET_ALLTIME) FLICKET_ALLTIME
FROM LIMIT_RATE
where timeid between #{condition.start} and #{condition.end} and myindex = #{condition.pointIndex} and
Phasic_Type in('A','B','C','T')
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</when>
<otherwise>
sum(UBalance_OverTime) UBALANCE_OVERTIME,
sum(Freq_Dev_OverTime) FREQ_DEV_OVERTIME,
sum(AllTime) ALLTIME
from limit_rate
where timeid between #{condition.start} and #{condition.end}
and myindex = #{condition.pointIndex}
and Phasic_Type = 'T'
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</otherwise>
</choose>
group by phasic_type
</select>
</mapper>

View File

@@ -0,0 +1,71 @@
<?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.pqs9000.mapper.report.GetFlickerDataMapper">
<select id="getFlickerData" resultType="java.util.HashMap">
<choose>
<when test="condition.b == true">
SELECT PHASIC_TYPE PHASETYPE,MAX(PST) PST_MAX,MIN(PST) PST_MIN,ROUND(AVG(PST) ,2) PST,MAX(CASE WHEN
PSTCP95
=#{condition.pstCount} THEN PST ELSE NULL END) PST_CP95 FROM ( SELECT T.*
,ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY PST DESC) PSTCP95
from
Data_Flicker
</when>
<otherwise>
SELECT PHASIC_TYPE PHASETYPE,MAX(PST_MAX) PST_MAX,MIN(PST_MIN) PST_MIN,ROUND(AVG(PST) ,2) PST,MAX(CASE
WHEN PSTCP95
=#{condition.pstCount} THEN PST ELSE NULL END) PST_CP95 FROM ( SELECT T.*
,ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY PST DESC) PSTCP95
from
Day_Flicker
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getLFlickerData" resultType="java.util.HashMap">
<choose>
<when test="condition.b == true">
SELECT PHASIC_TYPE PHASETYPE,MAX(PLT) PLT_MAX,MIN(PLT) PLT_MIN,ROUND(AVG(PLT) ,2) PLT,MAX(CASE WHEN
PLTCP95
=#{condition.pltCount} THEN PLT ELSE NULL END) PLT_CP95 FROM ( SELECT T.*
,ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY PLT DESC) PLTCP95
from
Data_plt
</when>
<otherwise>
SELECT PHASIC_TYPE PHASETYPE,MAX(PLT_MAX) PLT_MAX,MIN(PLT_MIN) PLT_MIN,ROUND(AVG(PLT) ,2) PLT,MAX(CASE
WHEN PLTCP95
=#{condition.pltCount} THEN PLT ELSE NULL END) PLT_CP95 FROM ( SELECT T.*
,ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY PLT DESC) PLTCP95
from
Day_plt
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getLLFlickerData" resultType="java.util.HashMap">
SELECT PHASIC_TYPE PHASETYPE,PLT_MAX,PLT_MIN,PLT,PLT_CP95,TIMEID
FROM DAY_PLT
where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
<?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.pqs9000.mapper.report.GetFrequencyDataMapper">
<select id="getFrequencyData" resultType="java.util.HashMap">
SELECT MAX(FREQ_MAX) FREQ_MAX,MIN(FREQ_MIN) FREQ_MIN,ROUND(AVG(FREQ) ,2) FREQ,
MAX(CASE WHEN FREQCP95 = #{condition.count}
THEN FREQ
ELSE NULL END) FREQ_CP95,
MAX(FREQ_DEV_MAX) FREQ_DEV_MAX,MIN(FREQ_DEV_MIN) FREQ_DEV_MIN,ROUND(AVG(FREQ_DEV) ,2)
FREQ_DEV,MAX(CASE WHEN FREQDEVCP95 = #{condition.count}
THEN FREQ_DEV
ELSE NULL END) FREQ_DEV_CP95
FROM (SELECT
T.*,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY FREQ DESC) FREQCP95,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY FREQ_DEV DESC) FREQDEVCP95
FROM
<choose>
<when test="condition.b == true">
Data_v
</when>
<otherwise>
Day_v
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and
phasic_type='T'
and timeid between #{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
</select>
<select id="getHFrequencyData" resultType="java.util.HashMap">
SELECT FREQ_DEV_MAX, FREQ_DEV_MIN, FREQ_DEV,FREQ_DEV_CP95,TIMEID
FROM DAY_V
where lineid=#{condition.pointIndex} and
phasic_type='T'
and timeid between #{condition.start} and #{condition.end}
</select>
</mapper>

View File

@@ -0,0 +1,261 @@
<?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.pqs9000.mapper.report.GetICurrentMapper">
<select id="getICurrent" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
max(I_1_MAX) I_1_MAX,min(I_1_MIN) I_1_MIN,round(avg(I_1) ,2) I_1,max(case when I1CP95 =#{condition.count} then I_1 else null end) I_1_CP95,
max(I_2_MAX) I_2_MAX,min(I_2_MIN) I_2_MIN,round(avg(I_2) ,2) I_2,max(case when I2CP95 =#{condition.count} then I_2 else null end) I_2_CP95,
max(I_3_MAX) I_3_MAX,min(I_3_MIN) I_3_MIN,round(avg(I_3) ,2) I_3,max(case when I3CP95 =#{condition.count} then I_3 else null end) I_3_CP95,
max(I_4_MAX) I_4_MAX,min(I_4_MIN) I_4_MIN,round(avg(I_4) ,2) I_4,max(case when I4CP95 =#{condition.count} then I_4 else null end) I_4_CP95,
max(I_5_MAX) I_5_MAX,min(I_5_MIN) I_5_MIN,round(avg(I_5) ,2) I_5,max(case when I5CP95 =#{condition.count} then I_5 else null end) I_5_CP95,
max(I_6_MAX) I_6_MAX,min(I_6_MIN) I_6_MIN,round(avg(I_6) ,2) I_6,max(case when I6CP95 =#{condition.count} then I_6 else null end) I_6_CP95,
max(I_7_MAX) I_7_MAX,min(I_7_MIN) I_7_MIN,round(avg(I_7) ,2) I_7,max(case when I7CP95 =#{condition.count} then I_7 else null end) I_7_CP95,
max(I_8_MAX) I_8_MAX,min(I_8_MIN) I_8_MIN,round(avg(I_8) ,2) I_8,max(case when I8CP95 =#{condition.count} then I_8 else null end) I_8_CP95,
max(I_9_MAX) I_9_MAX,min(I_9_MIN) I_9_MIN,round(avg(I_9) ,2) I_9,max(case when I9CP95 =#{condition.count} then I_9 else null end) I_9_CP95,
max(I_10_MAX) I_10_MAX,min(I_10_MIN) I_10_MIN,round(avg(I_10) ,2) I_10,max(case when I10CP95 =#{condition.count} then I_10 else null end) I_10_CP95,
max(I_11_MAX) I_11_MAX,min(I_11_MIN) I_11_MIN,round(avg(I_11) ,2) I_11,max(case when I11CP95 =#{condition.count} then I_11 else null end) I_11_CP95,
max(I_12_MAX) I_12_MAX,min(I_12_MIN) I_12_MIN,round(avg(I_12) ,2) I_12,max(case when I12CP95 =#{condition.count} then I_12 else null end) I_12_CP95,
max(I_13_MAX) I_13_MAX,min(I_13_MIN) I_13_MIN,round(avg(I_13) ,2) I_13,max(case when I13CP95 =#{condition.count} then I_13 else null end) I_13_CP95,
max(I_14_MAX) I_14_MAX,min(I_14_MIN) I_14_MIN,round(avg(I_14) ,2) I_14,max(case when I14CP95 =#{condition.count} then I_14 else null end) I_14_CP95,
max(I_15_MAX) I_15_MAX,min(I_15_MIN) I_15_MIN,round(avg(I_15) ,2) I_15,max(case when I15CP95 =#{condition.count} then I_15 else null end) I_15_CP95,
max(I_16_MAX) I_16_MAX,min(I_16_MIN) I_16_MIN,round(avg(I_16) ,2) I_16,max(case when I16CP95 =#{condition.count} then I_16 else null end) I_16_CP95,
max(I_17_MAX) I_17_MAX,min(I_17_MIN) I_17_MIN,round(avg(I_17) ,2) I_17,max(case when I17CP95 =#{condition.count} then I_17 else null end) I_17_CP95,
max(I_18_MAX) I_18_MAX,min(I_18_MIN) I_18_MIN,round(avg(I_18) ,2) I_18,max(case when I18CP95 =#{condition.count} then I_18 else null end) I_18_CP95,
max(I_19_MAX) I_19_MAX,min(I_19_MIN) I_19_MIN,round(avg(I_19) ,2) I_19,max(case when I19CP95 =#{condition.count} then I_19 else null end) I_19_CP95,
max(I_20_MAX) I_20_MAX,min(I_20_MIN) I_20_MIN,round(avg(I_20) ,2) I_20,max(case when I20CP95 =#{condition.count} then I_20 else null end) I_20_CP95,
max(I_21_MAX) I_21_MAX,min(I_21_MIN) I_21_MIN,round(avg(I_21) ,2) I_21,max(case when I21CP95 =#{condition.count} then I_21 else null end) I_21_CP95,
max(I_22_MAX) I_22_MAX,min(I_22_MIN) I_22_MIN,round(avg(I_22) ,2) I_22,max(case when I22CP95 =#{condition.count} then I_22 else null end) I_22_CP95,
max(I_23_MAX) I_23_MAX,min(I_23_MIN) I_23_MIN,round(avg(I_23) ,2) I_23,max(case when I23CP95 =#{condition.count} then I_23 else null end) I_23_CP95,
max(I_24_MAX) I_24_MAX,min(I_24_MIN) I_24_MIN,round(avg(I_24) ,2) I_24,max(case when I24CP95 =#{condition.count} then I_24 else null end) I_24_CP95,
max(I_25_MAX) I_25_MAX,min(I_25_MIN) I_25_MIN,round(avg(I_25) ,2) I_25,max(case when I25CP95 =#{condition.count} then I_25 else null end) I_25_CP95,
max(I_26_MAX) I_26_MAX,min(I_26_MIN) I_26_MIN,round(avg(I_26) ,2) I_26,max(case when I26CP95 =#{condition.count} then I_26 else null end) I_26_CP95,
max(I_27_MAX) I_27_MAX,min(I_27_MIN) I_27_MIN,round(avg(I_27) ,2) I_27,max(case when I27CP95 =#{condition.count} then I_27 else null end) I_27_CP95,
max(I_28_MAX) I_28_MAX,min(I_28_MIN) I_28_MIN,round(avg(I_28) ,2) I_28,max(case when I28CP95 =#{condition.count} then I_28 else null end) I_28_CP95,
max(I_29_MAX) I_29_MAX,min(I_29_MIN) I_29_MIN,round(avg(I_29) ,2) I_29,max(case when I29CP95 =#{condition.count} then I_29 else null end) I_29_CP95,
max(I_30_MAX) I_30_MAX,min(I_30_MIN) I_30_MIN,round(avg(I_30) ,2) I_30,max(case when I30CP95 =#{condition.count} then I_30 else null end) I_30_CP95,
max(I_31_MAX) I_31_MAX,min(I_31_MIN) I_31_MIN,round(avg(I_31) ,2) I_31,max(case when I31CP95 =#{condition.count} then I_31 else null end) I_31_CP95,
max(I_32_MAX) I_32_MAX,min(I_32_MIN) I_32_MIN,round(avg(I_32) ,2) I_32,max(case when I32CP95 =#{condition.count} then I_32 else null end) I_32_CP95,
max(I_33_MAX) I_33_MAX,min(I_33_MIN) I_33_MIN,round(avg(I_33) ,2) I_33,max(case when I33CP95 =#{condition.count} then I_33 else null end) I_33_CP95,
max(I_34_MAX) I_34_MAX,min(I_34_MIN) I_34_MIN,round(avg(I_34) ,2) I_34,max(case when I34CP95 =#{condition.count} then I_34 else null end) I_34_CP95,
max(I_35_MAX) I_35_MAX,min(I_35_MIN) I_35_MIN,round(avg(I_35) ,2) I_35,max(case when I35CP95 =#{condition.count} then I_35 else null end) I_35_CP95,
max(I_36_MAX) I_36_MAX,min(I_36_MIN) I_36_MIN,round(avg(I_36) ,2) I_36,max(case when I36CP95 =#{condition.count} then I_36 else null end) I_36_CP95,
max(I_37_MAX) I_37_MAX,min(I_37_MIN) I_37_MIN,round(avg(I_37) ,2) I_37,max(case when I37CP95 =#{condition.count} then I_37 else null end) I_37_CP95,
max(I_38_MAX) I_38_MAX,min(I_38_MIN) I_38_MIN,round(avg(I_38) ,2) I_38,max(case when I38CP95 =#{condition.count} then I_38 else null end) I_38_CP95,
max(I_39_MAX) I_39_MAX,min(I_39_MIN) I_39_MIN,round(avg(I_39) ,2) I_39,max(case when I39CP95 =#{condition.count} then I_39 else null end) I_39_CP95,
max(I_40_MAX) I_40_MAX,min(I_40_MIN) I_40_MIN,round(avg(I_40) ,2) I_40,max(case when I40CP95 =#{condition.count} then I_40 else null end) I_40_CP95,
max(I_41_MAX) I_41_MAX,min(I_41_MIN) I_41_MIN,round(avg(I_41) ,2) I_41,max(case when I41CP95 =#{condition.count} then I_41 else null end) I_41_CP95,
max(I_42_MAX) I_42_MAX,min(I_42_MIN) I_42_MIN,round(avg(I_42) ,2) I_42,max(case when I42CP95 =#{condition.count} then I_42 else null end) I_42_CP95,
max(I_43_MAX) I_43_MAX,min(I_43_MIN) I_43_MIN,round(avg(I_43) ,2) I_43,max(case when I43CP95 =#{condition.count} then I_43 else null end) I_43_CP95,
max(I_44_MAX) I_44_MAX,min(I_44_MIN) I_44_MIN,round(avg(I_44) ,2) I_44,max(case when I44CP95 =#{condition.count} then I_44 else null end) I_44_CP95,
max(I_45_MAX) I_45_MAX,min(I_45_MIN) I_45_MIN,round(avg(I_45) ,2) I_45,max(case when I45CP95 =#{condition.count} then I_45 else null end) I_45_CP95,
max(I_46_MAX) I_46_MAX,min(I_46_MIN) I_46_MIN,round(avg(I_46) ,2) I_46,max(case when I46CP95 =#{condition.count} then I_46 else null end) I_46_CP95,
max(I_47_MAX) I_47_MAX,min(I_47_MIN) I_47_MIN,round(avg(I_47) ,2) I_47,max(case when I47CP95 =#{condition.count} then I_47 else null end) I_47_CP95,
max(I_48_MAX) I_48_MAX,min(I_48_MIN) I_48_MIN,round(avg(I_48) ,2) I_48,max(case when I48CP95 =#{condition.count} then I_48 else null end) I_48_CP95,
max(I_49_MAX) I_49_MAX,min(I_49_MIN) I_49_MIN,round(avg(I_49) ,2) I_49,max(case when I49CP95 =#{condition.count} then I_49 else null end) I_49_CP95,
max(I_50_MAX) I_50_MAX,min(I_50_MIN) I_50_MIN,round(avg(I_50) ,2) I_50,max(case when I50CP95 =#{condition.count} then I_50 else null end) I_50_CP95
from ( select t.*,
row_number() over (partition by phasic_type order by I_1 desc) I1CP95,
row_number() over (partition by phasic_type order by I_2 desc) I2CP95,
row_number() over (partition by phasic_type order by I_3 desc) I3CP95,
row_number() over (partition by phasic_type order by I_4 desc) I4CP95,
row_number() over (partition by phasic_type order by I_5 desc) I5CP95,
row_number() over (partition by phasic_type order by I_6 desc) I6CP95,
row_number() over (partition by phasic_type order by I_7 desc) I7CP95,
row_number() over (partition by phasic_type order by I_8 desc) I8CP95,
row_number() over (partition by phasic_type order by I_9 desc) I9CP95,
row_number() over (partition by phasic_type order by I_10 desc) I10CP95,
row_number() over (partition by phasic_type order by I_11 desc) I11CP95,
row_number() over (partition by phasic_type order by I_12 desc) I12CP95,
row_number() over (partition by phasic_type order by I_13 desc) I13CP95,
row_number() over (partition by phasic_type order by I_14 desc) I14CP95,
row_number() over (partition by phasic_type order by I_15 desc) I15CP95,
row_number() over (partition by phasic_type order by I_16 desc) I16CP95,
row_number() over (partition by phasic_type order by I_17 desc) I17CP95,
row_number() over (partition by phasic_type order by I_18 desc) I18CP95,
row_number() over (partition by phasic_type order by I_19 desc) I19CP95,
row_number() over (partition by phasic_type order by I_20 desc) I20CP95,
row_number() over (partition by phasic_type order by I_21 desc) I21CP95,
row_number() over (partition by phasic_type order by I_22 desc) I22CP95,
row_number() over (partition by phasic_type order by I_23 desc) I23CP95,
row_number() over (partition by phasic_type order by I_24 desc) I24CP95,
row_number() over (partition by phasic_type order by I_25 desc) I25CP95,
row_number() over (partition by phasic_type order by I_26 desc) I26CP95,
row_number() over (partition by phasic_type order by I_27 desc) I27CP95,
row_number() over (partition by phasic_type order by I_28 desc) I28CP95,
row_number() over (partition by phasic_type order by I_29 desc) I29CP95,
row_number() over (partition by phasic_type order by I_30 desc) I30CP95,
row_number() over (partition by phasic_type order by I_31 desc) I31CP95,
row_number() over (partition by phasic_type order by I_32 desc) I32CP95,
row_number() over (partition by phasic_type order by I_33 desc) I33CP95,
row_number() over (partition by phasic_type order by I_34 desc) I34CP95,
row_number() over (partition by phasic_type order by I_35 desc) I35CP95,
row_number() over (partition by phasic_type order by I_36 desc) I36CP95,
row_number() over (partition by phasic_type order by I_37 desc) I37CP95,
row_number() over (partition by phasic_type order by I_38 desc) I38CP95,
row_number() over (partition by phasic_type order by I_39 desc) I39CP95,
row_number() over (partition by phasic_type order by I_40 desc) I40CP95,
row_number() over (partition by phasic_type order by I_41 desc) I41CP95,
row_number() over (partition by phasic_type order by I_42 desc) I42CP95,
row_number() over (partition by phasic_type order by I_43 desc) I43CP95,
row_number() over (partition by phasic_type order by I_44 desc) I44CP95,
row_number() over (partition by phasic_type order by I_45 desc) I45CP95,
row_number() over (partition by phasic_type order by I_46 desc) I46CP95,
row_number() over (partition by phasic_type order by I_47 desc) I47CP95,
row_number() over (partition by phasic_type order by I_48 desc) I48CP95,
row_number() over (partition by phasic_type order by I_49 desc) I49CP95,
row_number() over (partition by phasic_type order by I_50 desc) I50CP95
from
<choose>
<when test="condition.b == true">
Data_i
</when>
<otherwise>
Day_i
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getHICurrent" resultType="java.util.HashMap">
SELECT
PHASIC_TYPE PHASETYPE,
TIMEID,
I_${condition.times}_MAX,
I_${condition.times}_MIN,
I_${condition.times},
I_${condition.times}_CP95
FROM DAY_I
where lineid=#{condition.pointIndex}
and phasic_type in ('A','B','C')
and timeid between
#{condition.start} and #{condition.end}
</select>
<resultMap type="ReportValue" id="reportValue" autoMapping="true">
</resultMap>
<select id="VsideValue" resultMap="reportValue">
select max(ta.V_THD) FMAXVALUE
from
<choose>
<when test="condition.b == true">
Data_v
</when>
<otherwise>
Day_v
</otherwise>
</choose>
ta where ta.lineid=#{condition.pointIndex} and ta.phasic_type in ('A', 'B', 'C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="InsideValue" resultMap="reportValue">
select max(ta.i_1) FMAXVALUE, min(ta.i_1) MINVALUE
from
<choose>
<when test="condition.b == true">
Data_i
</when>
<otherwise>
Day_i
</otherwise>
</choose>
ta where ta.lineid=#{condition.pointIndex} and ta.phasic_type in ('A', 'B', 'C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="PsideValue" resultMap="reportValue">
select max(ta.p_1) FMAXVALUE, min(ta.p_1) MINVALUE
from
<choose>
<when test="condition.b == true">
Data_HarmPower_P
</when>
<otherwise>
Day_HarmPower_P
</otherwise>
</choose>
ta where ta.lineid=#{condition.pointIndex} and ta.phasic_type in ('T') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="QsideValue" resultMap="reportValue">
select max(ta.q_1) FMAXVALUE, min(ta.q_1) MINVALUE
from
<choose>
<when test="condition.b == true">
Data_HarmPower_Q
</when>
<otherwise>
Day_HarmPower_Q
</otherwise>
</choose>
ta where ta.lineid=#{condition.pointIndex} and ta.phasic_type in ('T') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getIMaxLimit" resultType="java.util.HashMap">
select
<foreach collection="number" index="index" item="item" open=" " separator="," close=" ">
max(case
when a.I${item}CP95 = #{condition.count} then
a.I_${item}
else
null
end) I_${item}_CP95
</foreach>
from (select t.*,
<foreach collection="number" index="index" item="item" open=" " separator="," close=" ">
row_number() over(partition by phasic_type order by I_${item} desc)
I${item}CP95
</foreach>
from Data_i t
where lineid = #{condition.pointIndex}
and phasic_type in ('A', 'B', 'C')
and timeid between #{condition.start}
and #{condition.end}
and QualityFlag = 0) a
union all (select
<foreach collection="number" index="index" item="item" open="" separator="," close=" ">
iharm_${item}
</foreach>
from overlimit where myindex =
#{condition.pointIndex})
</select>
</mapper>

View File

@@ -0,0 +1,10 @@
<?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.pqs9000.mapper.report.GetInHarmMapper">
<select id="getHInharm" resultType="java.util.HashMap">
SELECT PHASIC_TYPE PHASETYPE,TIMEID,
V_${condition.times}_MAX,V_${condition.times}_MIN,V_${condition.times},V_${condition.times}_CP95 FROM Day_InHarm_V
where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
</select>
</mapper>

View File

@@ -0,0 +1,127 @@
<?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.pqs9000.mapper.report.GetInICurrentMapper">
<select id="getICurrent" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
max(I_1_MAX) I_1_MAX,min(I_1_MIN) I_1_MIN,round(avg(I_1) ,2) I_1,max(case when I1CP95 =#{condition.count} then I_1 else null end) I_1_CP95,
max(I_2_MAX) I_2_MAX,min(I_2_MIN) I_2_MIN,round(avg(I_2) ,2) I_2,max(case when I2CP95 =#{condition.count} then I_2 else null end) I_2_CP95,
max(I_3_MAX) I_3_MAX,min(I_3_MIN) I_3_MIN,round(avg(I_3) ,2) I_3,max(case when I3CP95 =#{condition.count} then I_3 else null end) I_3_CP95,
max(I_4_MAX) I_4_MAX,min(I_4_MIN) I_4_MIN,round(avg(I_4) ,2) I_4,max(case when I4CP95 =#{condition.count} then I_4 else null end) I_4_CP95,
max(I_5_MAX) I_5_MAX,min(I_5_MIN) I_5_MIN,round(avg(I_5) ,2) I_5,max(case when I5CP95 =#{condition.count} then I_5 else null end) I_5_CP95,
max(I_6_MAX) I_6_MAX,min(I_6_MIN) I_6_MIN,round(avg(I_6) ,2) I_6,max(case when I6CP95 =#{condition.count} then I_6 else null end) I_6_CP95,
max(I_7_MAX) I_7_MAX,min(I_7_MIN) I_7_MIN,round(avg(I_7) ,2) I_7,max(case when I7CP95 =#{condition.count} then I_7 else null end) I_7_CP95,
max(I_8_MAX) I_8_MAX,min(I_8_MIN) I_8_MIN,round(avg(I_8) ,2) I_8,max(case when I8CP95 =#{condition.count} then I_8 else null end) I_8_CP95,
max(I_9_MAX) I_9_MAX,min(I_9_MIN) I_9_MIN,round(avg(I_9) ,2) I_9,max(case when I9CP95 =#{condition.count} then I_9 else null end) I_9_CP95,
max(I_10_MAX) I_10_MAX,min(I_10_MIN) I_10_MIN,round(avg(I_10) ,2) I_10,max(case when I10CP95 =#{condition.count} then I_10 else null end) I_10_CP95,
max(I_11_MAX) I_11_MAX,min(I_11_MIN) I_11_MIN,round(avg(I_11) ,2) I_11,max(case when I11CP95 =#{condition.count} then I_11 else null end) I_11_CP95,
max(I_12_MAX) I_12_MAX,min(I_12_MIN) I_12_MIN,round(avg(I_12) ,2) I_12,max(case when I12CP95 =#{condition.count} then I_12 else null end) I_12_CP95,
max(I_13_MAX) I_13_MAX,min(I_13_MIN) I_13_MIN,round(avg(I_13) ,2) I_13,max(case when I13CP95 =#{condition.count} then I_13 else null end) I_13_CP95,
max(I_14_MAX) I_14_MAX,min(I_14_MIN) I_14_MIN,round(avg(I_14) ,2) I_14,max(case when I14CP95 =#{condition.count} then I_14 else null end) I_14_CP95,
max(I_15_MAX) I_15_MAX,min(I_15_MIN) I_15_MIN,round(avg(I_15) ,2) I_15,max(case when I15CP95 =#{condition.count} then I_15 else null end) I_15_CP95,
max(I_16_MAX) I_16_MAX,min(I_16_MIN) I_16_MIN,round(avg(I_16) ,2) I_16,max(case when I16CP95 =#{condition.count} then I_16 else null end) I_16_CP95,
max(I_17_MAX) I_17_MAX,min(I_17_MIN) I_17_MIN,round(avg(I_17) ,2) I_17,max(case when I17CP95 =#{condition.count} then I_17 else null end) I_17_CP95,
max(I_18_MAX) I_18_MAX,min(I_18_MIN) I_18_MIN,round(avg(I_18) ,2) I_18,max(case when I18CP95 =#{condition.count} then I_18 else null end) I_18_CP95,
max(I_19_MAX) I_19_MAX,min(I_19_MIN) I_19_MIN,round(avg(I_19) ,2) I_19,max(case when I19CP95 =#{condition.count} then I_19 else null end) I_19_CP95,
max(I_20_MAX) I_20_MAX,min(I_20_MIN) I_20_MIN,round(avg(I_20) ,2) I_20,max(case when I20CP95 =#{condition.count} then I_20 else null end) I_20_CP95,
max(I_21_MAX) I_21_MAX,min(I_21_MIN) I_21_MIN,round(avg(I_21) ,2) I_21,max(case when I21CP95 =#{condition.count} then I_21 else null end) I_21_CP95,
max(I_22_MAX) I_22_MAX,min(I_22_MIN) I_22_MIN,round(avg(I_22) ,2) I_22,max(case when I22CP95 =#{condition.count} then I_22 else null end) I_22_CP95,
max(I_23_MAX) I_23_MAX,min(I_23_MIN) I_23_MIN,round(avg(I_23) ,2) I_23,max(case when I23CP95 =#{condition.count} then I_23 else null end) I_23_CP95,
max(I_24_MAX) I_24_MAX,min(I_24_MIN) I_24_MIN,round(avg(I_24) ,2) I_24,max(case when I24CP95 =#{condition.count} then I_24 else null end) I_24_CP95,
max(I_25_MAX) I_25_MAX,min(I_25_MIN) I_25_MIN,round(avg(I_25) ,2) I_25,max(case when I25CP95 =#{condition.count} then I_25 else null end) I_25_CP95,
max(I_26_MAX) I_26_MAX,min(I_26_MIN) I_26_MIN,round(avg(I_26) ,2) I_26,max(case when I26CP95 =#{condition.count} then I_26 else null end) I_26_CP95,
max(I_27_MAX) I_27_MAX,min(I_27_MIN) I_27_MIN,round(avg(I_27) ,2) I_27,max(case when I27CP95 =#{condition.count} then I_27 else null end) I_27_CP95,
max(I_28_MAX) I_28_MAX,min(I_28_MIN) I_28_MIN,round(avg(I_28) ,2) I_28,max(case when I28CP95 =#{condition.count} then I_28 else null end) I_28_CP95,
max(I_29_MAX) I_29_MAX,min(I_29_MIN) I_29_MIN,round(avg(I_29) ,2) I_29,max(case when I29CP95 =#{condition.count} then I_29 else null end) I_29_CP95,
max(I_30_MAX) I_30_MAX,min(I_30_MIN) I_30_MIN,round(avg(I_30) ,2) I_30,max(case when I30CP95 =#{condition.count} then I_30 else null end) I_30_CP95,
max(I_31_MAX) I_31_MAX,min(I_31_MIN) I_31_MIN,round(avg(I_31) ,2) I_31,max(case when I31CP95 =#{condition.count} then I_31 else null end) I_31_CP95,
max(I_32_MAX) I_32_MAX,min(I_32_MIN) I_32_MIN,round(avg(I_32) ,2) I_32,max(case when I32CP95 =#{condition.count} then I_32 else null end) I_32_CP95,
max(I_33_MAX) I_33_MAX,min(I_33_MIN) I_33_MIN,round(avg(I_33) ,2) I_33,max(case when I33CP95 =#{condition.count} then I_33 else null end) I_33_CP95,
max(I_34_MAX) I_34_MAX,min(I_34_MIN) I_34_MIN,round(avg(I_34) ,2) I_34,max(case when I34CP95 =#{condition.count} then I_34 else null end) I_34_CP95,
max(I_35_MAX) I_35_MAX,min(I_35_MIN) I_35_MIN,round(avg(I_35) ,2) I_35,max(case when I35CP95 =#{condition.count} then I_35 else null end) I_35_CP95,
max(I_36_MAX) I_36_MAX,min(I_36_MIN) I_36_MIN,round(avg(I_36) ,2) I_36,max(case when I36CP95 =#{condition.count} then I_36 else null end) I_36_CP95,
max(I_37_MAX) I_37_MAX,min(I_37_MIN) I_37_MIN,round(avg(I_37) ,2) I_37,max(case when I37CP95 =#{condition.count} then I_37 else null end) I_37_CP95,
max(I_38_MAX) I_38_MAX,min(I_38_MIN) I_38_MIN,round(avg(I_38) ,2) I_38,max(case when I38CP95 =#{condition.count} then I_38 else null end) I_38_CP95,
max(I_39_MAX) I_39_MAX,min(I_39_MIN) I_39_MIN,round(avg(I_39) ,2) I_39,max(case when I39CP95 =#{condition.count} then I_39 else null end) I_39_CP95,
max(I_40_MAX) I_40_MAX,min(I_40_MIN) I_40_MIN,round(avg(I_40) ,2) I_40,max(case when I40CP95 =#{condition.count} then I_40 else null end) I_40_CP95,
max(I_41_MAX) I_41_MAX,min(I_41_MIN) I_41_MIN,round(avg(I_41) ,2) I_41,max(case when I41CP95 =#{condition.count} then I_41 else null end) I_41_CP95,
max(I_42_MAX) I_42_MAX,min(I_42_MIN) I_42_MIN,round(avg(I_42) ,2) I_42,max(case when I42CP95 =#{condition.count} then I_42 else null end) I_42_CP95,
max(I_43_MAX) I_43_MAX,min(I_43_MIN) I_43_MIN,round(avg(I_43) ,2) I_43,max(case when I43CP95 =#{condition.count} then I_43 else null end) I_43_CP95,
max(I_44_MAX) I_44_MAX,min(I_44_MIN) I_44_MIN,round(avg(I_44) ,2) I_44,max(case when I44CP95 =#{condition.count} then I_44 else null end) I_44_CP95,
max(I_45_MAX) I_45_MAX,min(I_45_MIN) I_45_MIN,round(avg(I_45) ,2) I_45,max(case when I45CP95 =#{condition.count} then I_45 else null end) I_45_CP95,
max(I_46_MAX) I_46_MAX,min(I_46_MIN) I_46_MIN,round(avg(I_46) ,2) I_46,max(case when I46CP95 =#{condition.count} then I_46 else null end) I_46_CP95,
max(I_47_MAX) I_47_MAX,min(I_47_MIN) I_47_MIN,round(avg(I_47) ,2) I_47,max(case when I47CP95 =#{condition.count} then I_47 else null end) I_47_CP95,
max(I_48_MAX) I_48_MAX,min(I_48_MIN) I_48_MIN,round(avg(I_48) ,2) I_48,max(case when I48CP95 =#{condition.count} then I_48 else null end) I_48_CP95,
max(I_49_MAX) I_49_MAX,min(I_49_MIN) I_49_MIN,round(avg(I_49) ,2) I_49,max(case when I49CP95 =#{condition.count} then I_49 else null end) I_49_CP95,
max(I_50_MAX) I_50_MAX,min(I_50_MIN) I_50_MIN,round(avg(I_50) ,2) I_50,max(case when I50CP95 =#{condition.count} then I_50 else null end) I_50_CP95
from ( select t.*,
row_number() over (partition by phasic_type order by I_1 desc) I1CP95,
row_number() over (partition by phasic_type order by I_2 desc) I2CP95,
row_number() over (partition by phasic_type order by I_3 desc) I3CP95,
row_number() over (partition by phasic_type order by I_4 desc) I4CP95,
row_number() over (partition by phasic_type order by I_5 desc) I5CP95,
row_number() over (partition by phasic_type order by I_6 desc) I6CP95,
row_number() over (partition by phasic_type order by I_7 desc) I7CP95,
row_number() over (partition by phasic_type order by I_8 desc) I8CP95,
row_number() over (partition by phasic_type order by I_9 desc) I9CP95,
row_number() over (partition by phasic_type order by I_10 desc) I10CP95,
row_number() over (partition by phasic_type order by I_11 desc) I11CP95,
row_number() over (partition by phasic_type order by I_12 desc) I12CP95,
row_number() over (partition by phasic_type order by I_13 desc) I13CP95,
row_number() over (partition by phasic_type order by I_14 desc) I14CP95,
row_number() over (partition by phasic_type order by I_15 desc) I15CP95,
row_number() over (partition by phasic_type order by I_16 desc) I16CP95,
row_number() over (partition by phasic_type order by I_17 desc) I17CP95,
row_number() over (partition by phasic_type order by I_18 desc) I18CP95,
row_number() over (partition by phasic_type order by I_19 desc) I19CP95,
row_number() over (partition by phasic_type order by I_20 desc) I20CP95,
row_number() over (partition by phasic_type order by I_21 desc) I21CP95,
row_number() over (partition by phasic_type order by I_22 desc) I22CP95,
row_number() over (partition by phasic_type order by I_23 desc) I23CP95,
row_number() over (partition by phasic_type order by I_24 desc) I24CP95,
row_number() over (partition by phasic_type order by I_25 desc) I25CP95,
row_number() over (partition by phasic_type order by I_26 desc) I26CP95,
row_number() over (partition by phasic_type order by I_27 desc) I27CP95,
row_number() over (partition by phasic_type order by I_28 desc) I28CP95,
row_number() over (partition by phasic_type order by I_29 desc) I29CP95,
row_number() over (partition by phasic_type order by I_30 desc) I30CP95,
row_number() over (partition by phasic_type order by I_31 desc) I31CP95,
row_number() over (partition by phasic_type order by I_32 desc) I32CP95,
row_number() over (partition by phasic_type order by I_33 desc) I33CP95,
row_number() over (partition by phasic_type order by I_34 desc) I34CP95,
row_number() over (partition by phasic_type order by I_35 desc) I35CP95,
row_number() over (partition by phasic_type order by I_36 desc) I36CP95,
row_number() over (partition by phasic_type order by I_37 desc) I37CP95,
row_number() over (partition by phasic_type order by I_38 desc) I38CP95,
row_number() over (partition by phasic_type order by I_39 desc) I39CP95,
row_number() over (partition by phasic_type order by I_40 desc) I40CP95,
row_number() over (partition by phasic_type order by I_41 desc) I41CP95,
row_number() over (partition by phasic_type order by I_42 desc) I42CP95,
row_number() over (partition by phasic_type order by I_43 desc) I43CP95,
row_number() over (partition by phasic_type order by I_44 desc) I44CP95,
row_number() over (partition by phasic_type order by I_45 desc) I45CP95,
row_number() over (partition by phasic_type order by I_46 desc) I46CP95,
row_number() over (partition by phasic_type order by I_47 desc) I47CP95,
row_number() over (partition by phasic_type order by I_48 desc) I48CP95,
row_number() over (partition by phasic_type order by I_49 desc) I49CP95,
row_number() over (partition by phasic_type order by I_50 desc) I50CP95
from
<choose>
<when test="condition.b == true">
Data_InHarm_i
</when>
<otherwise>
Day_InHarm_i
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>)
group by phasic_type
</select>
</mapper>

View File

@@ -0,0 +1,152 @@
<?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.pqs9000.mapper.report.GetInVoltageRateMapper">
<select id="getInVoltageRate" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
max(V_2_MAX) V_2_MAX,min(V_2_MIN) V_2_MIN,round(avg(V_2) ,2) V_2,max(case when V2CP95 =#{condition.count} then V_2 else null end) V_2_CP95,
max(V_3_MAX) V_3_MAX,min(V_3_MIN) V_3_MIN,round(avg(V_3) ,2) V_3,max(case when V3CP95 =#{condition.count} then V_3 else null end) V_3_CP95,
max(V_4_MAX) V_4_MAX,min(V_4_MIN) V_4_MIN,round(avg(V_4) ,2) V_4,max(case when V4CP95 =#{condition.count} then V_4 else null end) V_4_CP95,
max(V_5_MAX) V_5_MAX,min(V_5_MIN) V_5_MIN,round(avg(V_5) ,2) V_5,max(case when V5CP95 =#{condition.count} then V_5 else null end) V_5_CP95,
max(V_6_MAX) V_6_MAX,min(V_6_MIN) V_6_MIN,round(avg(V_6) ,2) V_6,max(case when V6CP95 =#{condition.count} then V_6 else null end) V_6_CP95,
max(V_7_MAX) V_7_MAX,min(V_7_MIN) V_7_MIN,round(avg(V_7) ,2) V_7,max(case when V7CP95 =#{condition.count} then V_7 else null end) V_7_CP95,
max(V_8_MAX) V_8_MAX,min(V_8_MIN) V_8_MIN,round(avg(V_8) ,2) V_8,max(case when V8CP95 =#{condition.count} then V_8 else null end) V_8_CP95,
max(V_9_MAX) V_9_MAX,min(V_9_MIN) V_9_MIN,round(avg(V_9) ,2) V_9,max(case when V9CP95 =#{condition.count} then V_9 else null end) V_9_CP95,
max(V_10_MAX) V_10_MAX,min(V_10_MIN) V_10_MIN,round(avg(V_10) ,2) V_10,max(case when V10CP95 =#{condition.count} then V_10 else null end) V_10_CP95,
max(V_11_MAX) V_11_MAX,min(V_11_MIN) V_11_MIN,round(avg(V_11) ,2) V_11,max(case when V11CP95 =#{condition.count} then V_11 else null end) V_11_CP95,
max(V_12_MAX) V_12_MAX,min(V_12_MIN) V_12_MIN,round(avg(V_12) ,2) V_12,max(case when V12CP95 =#{condition.count} then V_12 else null end) V_12_CP95,
max(V_13_MAX) V_13_MAX,min(V_13_MIN) V_13_MIN,round(avg(V_13) ,2) V_13,max(case when V13CP95 =#{condition.count} then V_13 else null end) V_13_CP95,
max(V_14_MAX) V_14_MAX,min(V_14_MIN) V_14_MIN,round(avg(V_14) ,2) V_14,max(case when V14CP95 =#{condition.count} then V_14 else null end) V_14_CP95,
max(V_15_MAX) V_15_MAX,min(V_15_MIN) V_15_MIN,round(avg(V_15) ,2) V_15,max(case when V15CP95 =#{condition.count} then V_15 else null end) V_15_CP95,
max(V_16_MAX) V_16_MAX,min(V_16_MIN) V_16_MIN,round(avg(V_16) ,2) V_16,max(case when V16CP95 =#{condition.count} then V_16 else null end) V_16_CP95,
max(V_17_MAX) V_17_MAX,min(V_17_MIN) V_17_MIN,round(avg(V_17) ,2) V_17,max(case when V17CP95 =#{condition.count} then V_17 else null end) V_17_CP95,
max(V_18_MAX) V_18_MAX,min(V_18_MIN) V_18_MIN,round(avg(V_18) ,2) V_18,max(case when V18CP95 =#{condition.count} then V_18 else null end) V_18_CP95,
max(V_19_MAX) V_19_MAX,min(V_19_MIN) V_19_MIN,round(avg(V_19) ,2) V_19,max(case when V19CP95 =#{condition.count} then V_19 else null end) V_19_CP95,
max(V_20_MAX) V_20_MAX,min(V_20_MIN) V_20_MIN,round(avg(V_20) ,2) V_20,max(case when V20CP95 =#{condition.count} then V_20 else null end) V_20_CP95,
max(V_21_MAX) V_21_MAX,min(V_21_MIN) V_21_MIN,round(avg(V_21) ,2) V_21,max(case when V21CP95 =#{condition.count} then V_21 else null end) V_21_CP95,
max(V_22_MAX) V_22_MAX,min(V_22_MIN) V_22_MIN,round(avg(V_22) ,2) V_22,max(case when V22CP95 =#{condition.count} then V_22 else null end) V_22_CP95,
max(V_23_MAX) V_23_MAX,min(V_23_MIN) V_23_MIN,round(avg(V_23) ,2) V_23,max(case when V23CP95 =#{condition.count} then V_23 else null end) V_23_CP95,
max(V_24_MAX) V_24_MAX,min(V_24_MIN) V_24_MIN,round(avg(V_24) ,2) V_24,max(case when V24CP95 =#{condition.count} then V_24 else null end) V_24_CP95,
max(V_25_MAX) V_25_MAX,min(V_25_MIN) V_25_MIN,round(avg(V_25) ,2) V_25,max(case when V25CP95 =#{condition.count} then V_25 else null end) V_25_CP95,
max(V_26_MAX) V_26_MAX,min(V_26_MIN) V_26_MIN,round(avg(V_26) ,2) V_26,max(case when V26CP95 =#{condition.count} then V_26 else null end) V_26_CP95,
max(V_27_MAX) V_27_MAX,min(V_27_MIN) V_27_MIN,round(avg(V_27) ,2) V_27,max(case when V27CP95 =#{condition.count} then V_27 else null end) V_27_CP95,
max(V_28_MAX) V_28_MAX,min(V_28_MIN) V_28_MIN,round(avg(V_28) ,2) V_28,max(case when V28CP95 =#{condition.count} then V_28 else null end) V_28_CP95,
max(V_29_MAX) V_29_MAX,min(V_29_MIN) V_29_MIN,round(avg(V_29) ,2) V_29,max(case when V29CP95 =#{condition.count} then V_29 else null end) V_29_CP95,
max(V_30_MAX) V_30_MAX,min(V_30_MIN) V_30_MIN,round(avg(V_30) ,2) V_30,max(case when V30CP95 =#{condition.count} then V_30 else null end) V_30_CP95,
max(V_31_MAX) V_31_MAX,min(V_31_MIN) V_31_MIN,round(avg(V_31) ,2) V_31,max(case when V31CP95 =#{condition.count} then V_31 else null end) V_31_CP95,
max(V_32_MAX) V_32_MAX,min(V_32_MIN) V_32_MIN,round(avg(V_32) ,2) V_32,max(case when V32CP95 =#{condition.count} then V_32 else null end) V_32_CP95,
max(V_33_MAX) V_33_MAX,min(V_33_MIN) V_33_MIN,round(avg(V_33) ,2) V_33,max(case when V33CP95 =#{condition.count} then V_33 else null end) V_33_CP95,
max(V_34_MAX) V_34_MAX,min(V_34_MIN) V_34_MIN,round(avg(V_34) ,2) V_34,max(case when V34CP95 =#{condition.count} then V_34 else null end) V_34_CP95,
max(V_35_MAX) V_35_MAX,min(V_35_MIN) V_35_MIN,round(avg(V_35) ,2) V_35,max(case when V35CP95 =#{condition.count} then V_35 else null end) V_35_CP95,
max(V_36_MAX) V_36_MAX,min(V_36_MIN) V_36_MIN,round(avg(V_36) ,2) V_36,max(case when V36CP95 =#{condition.count} then V_36 else null end) V_36_CP95,
max(V_37_MAX) V_37_MAX,min(V_37_MIN) V_37_MIN,round(avg(V_37) ,2) V_37,max(case when V37CP95 =#{condition.count} then V_37 else null end) V_37_CP95,
max(V_38_MAX) V_38_MAX,min(V_38_MIN) V_38_MIN,round(avg(V_38) ,2) V_38,max(case when V38CP95 =#{condition.count} then V_38 else null end) V_38_CP95,
max(V_39_MAX) V_39_MAX,min(V_39_MIN) V_39_MIN,round(avg(V_39) ,2) V_39,max(case when V39CP95 =#{condition.count} then V_39 else null end) V_39_CP95,
max(V_40_MAX) V_40_MAX,min(V_40_MIN) V_40_MIN,round(avg(V_40) ,2) V_40,max(case when V40CP95 =#{condition.count} then V_40 else null end) V_40_CP95,
max(V_41_MAX) V_41_MAX,min(V_41_MIN) V_41_MIN,round(avg(V_41) ,2) V_41,max(case when V41CP95 =#{condition.count} then V_41 else null end) V_41_CP95,
max(V_42_MAX) V_42_MAX,min(V_42_MIN) V_42_MIN,round(avg(V_42) ,2) V_42,max(case when V42CP95 =#{condition.count} then V_42 else null end) V_42_CP95,
max(V_43_MAX) V_43_MAX,min(V_43_MIN) V_43_MIN,round(avg(V_43) ,2) V_43,max(case when V43CP95 =#{condition.count} then V_43 else null end) V_43_CP95,
max(V_44_MAX) V_44_MAX,min(V_44_MIN) V_44_MIN,round(avg(V_44) ,2) V_44,max(case when V44CP95 =#{condition.count} then V_44 else null end) V_44_CP95,
max(V_45_MAX) V_45_MAX,min(V_45_MIN) V_45_MIN,round(avg(V_45) ,2) V_45,max(case when V45CP95 =#{condition.count} then V_45 else null end) V_45_CP95,
max(V_46_MAX) V_46_MAX,min(V_46_MIN) V_46_MIN,round(avg(V_46) ,2) V_46,max(case when V46CP95 =#{condition.count} then V_46 else null end) V_46_CP95,
max(V_47_MAX) V_47_MAX,min(V_47_MIN) V_47_MIN,round(avg(V_47) ,2) V_47,max(case when V47CP95 =#{condition.count} then V_47 else null end) V_47_CP95,
max(V_48_MAX) V_48_MAX,min(V_48_MIN) V_48_MIN,round(avg(V_48) ,2) V_48,max(case when V48CP95 =#{condition.count} then V_48 else null end) V_48_CP95,
max(V_49_MAX) V_49_MAX,min(V_49_MIN) V_49_MIN,round(avg(V_49) ,2) V_49,max(case when V49CP95 =#{condition.count} then V_49 else null end) V_49_CP95,
max(V_50_MAX) V_50_MAX,min(V_50_MIN) V_50_MIN,round(avg(V_50) ,2) V_50,max(case when V50CP95 =#{condition.count} then V_50 else null end) V_50_CP95
from ( select t.*,
row_number() over (partition by phasic_type order by V_2 desc) V2CP95,
row_number() over (partition by phasic_type order by V_3 desc) V3CP95,
row_number() over (partition by phasic_type order by V_4 desc) V4CP95,
row_number() over (partition by phasic_type order by V_5 desc) V5CP95,
row_number() over (partition by phasic_type order by V_6 desc) V6CP95,
row_number() over (partition by phasic_type order by V_7 desc) V7CP95,
row_number() over (partition by phasic_type order by V_8 desc) V8CP95,
row_number() over (partition by phasic_type order by V_9 desc) V9CP95,
row_number() over (partition by phasic_type order by V_10 desc) V10CP95,
row_number() over (partition by phasic_type order by V_11 desc) V11CP95,
row_number() over (partition by phasic_type order by V_12 desc) V12CP95,
row_number() over (partition by phasic_type order by V_13 desc) V13CP95,
row_number() over (partition by phasic_type order by V_14 desc) V14CP95,
row_number() over (partition by phasic_type order by V_15 desc) V15CP95,
row_number() over (partition by phasic_type order by V_16 desc) V16CP95,
row_number() over (partition by phasic_type order by V_17 desc) V17CP95,
row_number() over (partition by phasic_type order by V_18 desc) V18CP95,
row_number() over (partition by phasic_type order by V_19 desc) V19CP95,
row_number() over (partition by phasic_type order by V_20 desc) V20CP95,
row_number() over (partition by phasic_type order by V_21 desc) V21CP95,
row_number() over (partition by phasic_type order by V_22 desc) V22CP95,
row_number() over (partition by phasic_type order by V_23 desc) V23CP95,
row_number() over (partition by phasic_type order by V_24 desc) V24CP95,
row_number() over (partition by phasic_type order by V_25 desc) V25CP95,
row_number() over (partition by phasic_type order by V_26 desc) V26CP95,
row_number() over (partition by phasic_type order by V_27 desc) V27CP95,
row_number() over (partition by phasic_type order by V_28 desc) V28CP95,
row_number() over (partition by phasic_type order by V_29 desc) V29CP95,
row_number() over (partition by phasic_type order by V_30 desc) V30CP95,
row_number() over (partition by phasic_type order by V_31 desc) V31CP95,
row_number() over (partition by phasic_type order by V_32 desc) V32CP95,
row_number() over (partition by phasic_type order by V_33 desc) V33CP95,
row_number() over (partition by phasic_type order by V_34 desc) V34CP95,
row_number() over (partition by phasic_type order by V_35 desc) V35CP95,
row_number() over (partition by phasic_type order by V_36 desc) V36CP95,
row_number() over (partition by phasic_type order by V_37 desc) V37CP95,
row_number() over (partition by phasic_type order by V_38 desc) V38CP95,
row_number() over (partition by phasic_type order by V_39 desc) V39CP95,
row_number() over (partition by phasic_type order by V_40 desc) V40CP95,
row_number() over (partition by phasic_type order by V_41 desc) V41CP95,
row_number() over (partition by phasic_type order by V_42 desc) V42CP95,
row_number() over (partition by phasic_type order by V_43 desc) V43CP95,
row_number() over (partition by phasic_type order by V_44 desc) V44CP95,
row_number() over (partition by phasic_type order by V_45 desc) V45CP95,
row_number() over (partition by phasic_type order by V_46 desc) V46CP95,
row_number() over (partition by phasic_type order by V_47 desc) V47CP95,
row_number() over (partition by phasic_type order by V_48 desc) V48CP95,
row_number() over (partition by phasic_type order by V_49 desc) V49CP95,
row_number() over (partition by phasic_type order by V_50 desc) V50CP95
from
<choose>
<when test="condition.b == true">
Data_InHarm_V
</when>
<otherwise>
Day_InHarm_V
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>)
group by phasic_type
</select>
<select id="getInFirstHarmonic" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE,
MAX(V_1_MAX) MAXVALUE,MIN(V_1_MIN) MINVALUE,ROUND(AVG(V_1) ,2) MEANVALUE
,MAX(CASE WHEN V1CP95 =#{condition.count} THEN V_1 ELSE NULL END) CP95VALUE
FROM ( SELECT T.*,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY V_1 DESC) V1CP95
from
<choose>
<when test="condition.b == true">
Data_V
</when>
<otherwise>
Day_V
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>)
group by phasic_type
</select>
</mapper>

View File

@@ -0,0 +1,26 @@
<?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.pqs9000.mapper.report.GetInegDataMapper">
<select id="getInegData" resultType="java.util.HashMap">
SELECT PHASIC_TYPE PHASETYPE,TIMEID,
i_neg_MAX,i_neg_MIN,i_neg,i_neg_CP95 FROM DAY_I
where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
</select>
<select id="getDataByMonth" resultType="com.pqs9000.pojo.report.IntegrityDetailVo">
SELECT
#{month} startTime,
LINE_INDEX lineId,
SUM(DUE) due,
SUM("REAL") REAL,
ROUND(SUM("REAL")/SUM(DUE)*100,2) rate,
CASE WHEN SUM(DUE) &lt; SUM("REAL") THEN '实收数据大于应收数据,请检查设备统计间隔设置是否正确' ELSE NULL END explain
FROM
PQS_INTEGRITY
WHERE
TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND LINE_INDEX = #{lineId}
GROUP BY LINE_INDEX
</select>
</mapper>

View File

@@ -0,0 +1,100 @@
<?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.pqs9000.mapper.report.GetPowerDataMapper">
<select id="getPowerP" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE, MAX(P_MAX) FMAXVALUE,MIN(P_MIN) MINVALUE,ROUND(AVG(P) ,2)
MEANVALUE,MAX(CASE WHEN PCP95 = #{condition.count} THEN P ELSE NULL END) CP95VALUE
from ( select t.*,row_number() over (partition by phasic_type order by P desc) PCP95 from
<choose>
<when test="condition.b == true">
Data_HarmPower_P
</when>
<otherwise>
Day_HarmPower_P
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and phasic_type in('A','B','C','T') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getPowerQ" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE, MAX(Q_MAX) FMAXVALUE,MIN(Q_MIN) MINVALUE,ROUND(AVG(Q) ,2)
MEANVALUE,MAX(CASE WHEN QCP95 = #{condition.count} THEN Q ELSE NULL END) CP95VALUE
from ( select t.*,row_number() over (partition by phasic_type order by Q desc) QCP95 from
<choose>
<when test="condition.b == true">
Data_HarmPower_Q
</when>
<otherwise>
Day_HarmPower_Q
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and phasic_type in('A','B','C','T') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getPowerS" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE, MAX(S_MAX) FMAXVALUE,MIN(S_MIN) MINVALUE,ROUND(AVG(S) ,2)
MEANVALUE,MAX(CASE WHEN SCP95 = #{condition.count} THEN S ELSE NULL END) CP95VALUE
from ( select t.*,row_number() over (partition by phasic_type order by S desc) SCP95 from
<choose>
<when test="condition.b == true">
Data_HarmPower_S
</when>
<otherwise>
Day_HarmPower_S
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and phasic_type in('A','B','C','T') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getPF" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE, MAX(PF_MAX) FMAXVALUE,MIN(PF_MIN) MINVALUE,ROUND(AVG(PF) ,2)
MEANVALUE,MAX(CASE WHEN PFCP95 = #{condition.count} THEN PF ELSE NULL END) CP95VALUE
from ( select t.*,row_number() over (partition by phasic_type order by PF desc) PFCP95 from
<choose>
<when test="condition.b == true">
Data_HarmPower_P
</when>
<otherwise>
Day_HarmPower_P
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and phasic_type in('A','B','C','T') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
</mapper>

View File

@@ -0,0 +1,106 @@
<?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.pqs9000.mapper.report.GetThreephaseDataMapper">
<select id="getThreephaseV" resultType="java.util.HashMap">
SELECT MAX(V_UNBALANCE_MAX) V_UNBALANCE_MAX,MIN(V_UNBALANCE_MIN)
V_UNBALANCE_MIN,ROUND(AVG(V_UNBALANCE) ,2) V_UNBALANCE,
MAX(CASE WHEN VUNBALANCECP95 = #{condition.count}
THEN V_UNBALANCE
ELSE NULL END) V_UNBALANCE_CP95
,MAX(V_POS_MAX) V_POS_MAX,MIN(V_POS_MIN) V_POS_MIN,ROUND(AVG(V_POS) ,2)
V_POS,
MAX(CASE WHEN VPOSCP95 = #{condition.count}
THEN V_POS
ELSE NULL END) V_POS_CP95
,MAX(V_NEG_MAX) V_NEG_MAX,MIN(V_NEG_MIN) V_NEG_MIN,ROUND(AVG(V_NEG) ,2)
V_NEG,
MAX(CASE WHEN VNEGCP95 = #{condition.count}
THEN V_NEG
ELSE NULL END) V_NEG_CP95
,MAX(V_ZERO_MAX) V_ZERO_MAX,MIN(V_ZERO_MIN) V_ZERO_MIN,ROUND(AVG(V_ZERO) ,2)
V_ZERO,
MAX(CASE WHEN VZEROCP95 = #{condition.count}
THEN V_ZERO
ELSE NULL END) V_ZERO_CP95
FROM (SELECT
t.*,
row_number() over (partition BY phasic_type ORDER BY V_Unbalance DESC) Vunbalancecp95,
row_number() over (partition BY phasic_type ORDER BY V_Pos DESC) Vposcp95,
row_number() over (partition BY phasic_type ORDER BY V_Neg DESC) Vnegcp95,
row_number() over (partition BY phasic_type ORDER BY V_Zero DESC) Vzerocp95
from
<choose>
<when test="condition.b == true">
data_V
</when>
<otherwise>
day_V
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and timeid between
#{condition.start} and #{condition.end} and phasic_type = 'T'
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
</select>
<select id="getThreephaseI" resultType="java.util.HashMap">
SELECT MAX(I_UNBALANCE_MAX) I_UNBALANCE_MAX,MIN(I_UNBALANCE_MIN)
I_UNBALANCE_MIN,ROUND(AVG(I_UNBALANCE) ,2) I_UNBALANCE,
MAX(CASE WHEN IUNBALANCECP95 = #{condition.count}
THEN I_UNBALANCE
ELSE NULL END) I_UNBALANCE_CP95
,MAX(I_POS_MAX) I_POS_MAX,MIN(I_POS_MIN) I_POS_MIN,ROUND(AVG(I_POS) ,2)
I_POS,
MAX(CASE WHEN IPOSCP95 = #{condition.count}
THEN I_POS
ELSE NULL END) I_POS_CP95
,MAX(I_NEG_MAX) I_NEG_MAX,MIN(I_NEG_MIN) I_NEG_MIN,ROUND(AVG(I_NEG) ,2)
I_NEG,
MAX(CASE WHEN INEGCP95 = #{condition.count}
THEN I_NEG
ELSE NULL END) I_NEG_CP95
,MAX(I_ZERO_MAX) I_ZERO_MAX,MIN(I_ZERO_MIN) I_ZERO_MIN,ROUND(AVG(I_ZERO) ,2)
I_ZERO,
MAX(CASE WHEN IZEROCP95 = #{condition.count}
THEN I_ZERO
ELSE NULL END) I_ZERO_CP95
FROM (SELECT
t.*,
row_number() over (partition BY phasic_type ORDER BY I_Unbalance DESC) Iunbalancecp95,
row_number() over (partition BY phasic_type ORDER BY I_Pos DESC) Iposcp95,
row_number() over (partition BY phasic_type ORDER BY I_Neg DESC) Inegcp95,
row_number() over (partition BY phasic_type ORDER BY I_Zero DESC) Izerocp95
from
<choose>
<when test="condition.b == true">
data_I
</when>
<otherwise>
day_I
</otherwise>
</choose>
t
where lineid=#{condition.pointIndex} and timeid between
#{condition.start} and #{condition.end} and phasic_type = 'T'
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
</select>
<select id="getHThreephase" resultType="java.util.HashMap">
SELECT V_UNBALANCE_MAX,V_UNBALANCE_MIN,TIMEID
,V_UNBALANCE,
V_UNBALANCE_CP95
FROM DAY_V
where lineid=#{condition.pointIndex} and timeid between
#{condition.start} and #{condition.end} and phasic_type = 'T'
</select>
</mapper>

View File

@@ -0,0 +1,39 @@
<?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.pqs9000.mapper.report.GetVdeviationDataMapper">
<select id="getVdeviationData" resultType="java.util.HashMap">
SELECT PHASIC_TYPE PHASETYPE,MAX(VU_DEV_MAX) VU_DEV_MAX,MIN(VU_DEV_MIN) VU_DEV_MIN,ROUND(AVG(VU_DEV) ,2)
VU_DEV,MAX(CASE WHEN VUDEVCP95 =#{condition.count}
THEN VU_DEV ELSE NULL END) VU_DEV_CP95,MAX(VL_DEV_MAX) VL_DEV_MAX,MIN(VL_DEV_MIN) VL_DEV_MIN,ROUND(AVG(VL_DEV)
,2) VL_DEV,MAX(CASE WHEN VLDEVCP95 = #{condition.count} THEN VL_DEV ELSE NULL END) VL_DEV_CP95
from ( select t.*,row_number() over (partition by
phasic_type order by VU_Dev desc) VUDEVCP95,
row_number() over (partition by phasic_type order by VL_Dev desc) VLDEVCP95 from
<choose>
<when test="condition.b == true">
Data_v
</when>
<otherwise>
Day_v
</otherwise>
</choose>
t where
lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getHVdeviationData" resultType="java.util.HashMap">
select PHASIC_TYPE PHASETYPE,TIMEID,VU_DEV_MAX,VU_DEV_MIN,VU_DEV
,VU_DEV_CP95,VL_DEV_MAX,VL_DEV_MIN,
VL_DEV,VL_DEV_CP95 from DAY_V where
lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start} and #{condition.end}
</select>
</mapper>

View File

@@ -0,0 +1,195 @@
<?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.pqs9000.mapper.report.GetVirtualDataMapper">
<select id="getTotalCP95Data" resultType="java.lang.Integer">
SELECT count(rms) total
FROM data_v
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A') AND timeid BETWEEN #{condition.start} AND
#{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getTotalCP95Day" resultType="java.lang.Integer">
SELECT count(rms) total
FROM day_v
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A') AND timeid BETWEEN #{condition.start} AND
#{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getTotalPltCP95Data" resultType="java.lang.Integer">
SELECT count(plt) total
FROM data_plt
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A') AND timeid BETWEEN #{condition.start} AND
#{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getTotalPltCP95Day" resultType="java.lang.Integer">
SELECT count(plt) total
FROM day_plt
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A') AND timeid BETWEEN #{condition.start} AND
#{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getTotalPstCP95Data" resultType="java.lang.Integer">
SELECT count(pst) total
FROM data_flicker
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A') AND timeid BETWEEN #{condition.start} AND
#{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getTotalPstCP95Day" resultType="java.lang.Integer">
SELECT count(pst) total
FROM day_flicker
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A') AND timeid BETWEEN #{condition.start} AND
#{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>
</select>
<select id="getVirtualDataV" resultType="ReportValue">
SELECT
PHASIC_TYPE PHASETYPE,
ROUND(AVG(RMS), 2) MEANVALUE,
MAX(RMS_MAX) FMAXVALUE,
MIN(RMS_MIN) MINVALUE,
MAX(CASE WHEN RMSCP95 = #{condition.count}
THEN RMS
ELSE NULL END) CP95VALUE
FROM (SELECT
T.*,
ROW_NUMBER() OVER(PARTITION BY PHASIC_TYPE ORDER BY RMS DESC) RMSCP95
FROM
<choose>
<when test="condition.b == true">
data_v
</when>
<otherwise>
day_v
</otherwise>
</choose>
t
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A', 'B', 'C') AND
timeid BETWEEN #{condition.start} AND #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
GROUP BY phasic_type
</select>
<select id="getVirtualDataI" resultType="ReportValue">
SELECT
PHASIC_TYPE PHASETYPE,
ROUND(AVG(RMS), 2) MEANVALUE,
MAX(RMS_MAX) FMAXVALUE,
MIN(RMS_MIN) MINVALUE,
MAX(CASE WHEN RMSCP95 = #{condition.count}
THEN RMS
ELSE NULL END) CP95VALUE
FROM (SELECT
t.*,
row_number() over(partition BY phasic_type ORDER BY rms DESC) rmscp95
FROM
<choose>
<when test="condition.b == true">
data_i
</when>
<otherwise>
day_i
</otherwise>
</choose>
t
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('A', 'B', 'C') AND
timeid BETWEEN #{condition.start} AND #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
GROUP BY phasic_type
</select>
<select id="getVVirtualData" resultType="java.util.HashMap">
SELECT
ROUND(AVG(RMSAB), 2) RMSAB,
MAX(RMSAB_MAX) RMSAB_MAX,
MIN(RMSAB_MIN) RMSAB_MIN,
MAX(CASE WHEN RMSABCP95 = #{condition.count}
THEN RMSAB
ELSE NULL END) RMSAB_CP95,
ROUND(AVG(RMSBC), 2) RMSBC,
MAX(RMSBC_MAX) RMSBC_MAX,
MIN(RMSBC_MIN) RMSBC_MIN,
MAX(CASE WHEN RMSBCCP95 = #{condition.count}
THEN RMSBC
ELSE NULL END) RMSBC_CP95,
ROUND(AVG(RMSCA), 2) RMSCA,
MAX(RMSCA_MAX) RMSCA_MAX,
MIN(RMSCA_MIN) RMSCA_MIN,
MAX(CASE WHEN RMSCACP95 = #{condition.count}
THEN RMSCA
ELSE NULL END) RMSCA_CP95
FROM (SELECT
T.*,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY RMS DESC) RMSCP95,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY RMSAB DESC) RMSABCP95,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY RMSBC DESC) RMSBCCP95,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY RMSCA DESC) RMSCACP95
FROM
<choose>
<when test="condition.b == true">
Data_v
</when>
<otherwise>
Day_v
</otherwise>
</choose>
t
WHERE lineid = #{condition.pointIndex} AND phasic_type IN ('T') AND
timeid BETWEEN #{condition.start} AND #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
</select>
</mapper>

View File

@@ -0,0 +1,33 @@
<?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.pqs9000.mapper.report.GetVoltageMapper">
<select id="getVoltageData" resultType="ReportValue">
select phasic_type PHASETYPE,
<choose>
<when test="condition.b == true">
MAX(FLUC) FMAXVALUE,MIN(FLUC) MINVALUE,ROUND(AVG(FLUC) ,2) MEANVALUE
,MAX(CASE WHEN FLUCCP95 =#{condition.count} THEN FLUC ELSE NULL END) CP95VALUE
FROM ( SELECT T.*,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY FLUC DESC) FLUCCP95
from Data_fluc
</when>
<otherwise>
MAX(FLUC_MAX) FMAXVALUE,MIN(FLUC_MIN) MINVALUE,ROUND(AVG(FLUC) ,2) MEANVALUE
,MAX(CASE WHEN FLUCCP95 =#{condition.count} THEN FLUC ELSE NULL END) CP95VALUE
FROM ( SELECT T.*,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY FLUC DESC) FLUCCP95
from Day_fluc
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
</mapper>

View File

@@ -0,0 +1,160 @@
<?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.pqs9000.mapper.report.GetVoltageRateMapper">
<select id="getVoltageRate" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
max(V_2_MAX) V_2_MAX,min(V_2_MIN) V_2_MIN,round(avg(V_2) ,2) V_2,max(case when V2CP95 =#{condition.count} then V_2 else null end) V_2_CP95,
max(V_3_MAX) V_3_MAX,min(V_3_MIN) V_3_MIN,round(avg(V_3) ,2) V_3,max(case when V3CP95 =#{condition.count} then V_3 else null end) V_3_CP95,
max(V_4_MAX) V_4_MAX,min(V_4_MIN) V_4_MIN,round(avg(V_4) ,2) V_4,max(case when V4CP95 =#{condition.count} then V_4 else null end) V_4_CP95,
max(V_5_MAX) V_5_MAX,min(V_5_MIN) V_5_MIN,round(avg(V_5) ,2) V_5,max(case when V5CP95 =#{condition.count} then V_5 else null end) V_5_CP95,
max(V_6_MAX) V_6_MAX,min(V_6_MIN) V_6_MIN,round(avg(V_6) ,2) V_6,max(case when V6CP95 =#{condition.count} then V_6 else null end) V_6_CP95,
max(V_7_MAX) V_7_MAX,min(V_7_MIN) V_7_MIN,round(avg(V_7) ,2) V_7,max(case when V7CP95 =#{condition.count} then V_7 else null end) V_7_CP95,
max(V_8_MAX) V_8_MAX,min(V_8_MIN) V_8_MIN,round(avg(V_8) ,2) V_8,max(case when V8CP95 =#{condition.count} then V_8 else null end) V_8_CP95,
max(V_9_MAX) V_9_MAX,min(V_9_MIN) V_9_MIN,round(avg(V_9) ,2) V_9,max(case when V9CP95 =#{condition.count} then V_9 else null end) V_9_CP95,
max(V_10_MAX) V_10_MAX,min(V_10_MIN) V_10_MIN,round(avg(V_10) ,2) V_10,max(case when V10CP95 =#{condition.count} then V_10 else null end) V_10_CP95,
max(V_11_MAX) V_11_MAX,min(V_11_MIN) V_11_MIN,round(avg(V_11) ,2) V_11,max(case when V11CP95 =#{condition.count} then V_11 else null end) V_11_CP95,
max(V_12_MAX) V_12_MAX,min(V_12_MIN) V_12_MIN,round(avg(V_12) ,2) V_12,max(case when V12CP95 =#{condition.count} then V_12 else null end) V_12_CP95,
max(V_13_MAX) V_13_MAX,min(V_13_MIN) V_13_MIN,round(avg(V_13) ,2) V_13,max(case when V13CP95 =#{condition.count} then V_13 else null end) V_13_CP95,
max(V_14_MAX) V_14_MAX,min(V_14_MIN) V_14_MIN,round(avg(V_14) ,2) V_14,max(case when V14CP95 =#{condition.count} then V_14 else null end) V_14_CP95,
max(V_15_MAX) V_15_MAX,min(V_15_MIN) V_15_MIN,round(avg(V_15) ,2) V_15,max(case when V15CP95 =#{condition.count} then V_15 else null end) V_15_CP95,
max(V_16_MAX) V_16_MAX,min(V_16_MIN) V_16_MIN,round(avg(V_16) ,2) V_16,max(case when V16CP95 =#{condition.count} then V_16 else null end) V_16_CP95,
max(V_17_MAX) V_17_MAX,min(V_17_MIN) V_17_MIN,round(avg(V_17) ,2) V_17,max(case when V17CP95 =#{condition.count} then V_17 else null end) V_17_CP95,
max(V_18_MAX) V_18_MAX,min(V_18_MIN) V_18_MIN,round(avg(V_18) ,2) V_18,max(case when V18CP95 =#{condition.count} then V_18 else null end) V_18_CP95,
max(V_19_MAX) V_19_MAX,min(V_19_MIN) V_19_MIN,round(avg(V_19) ,2) V_19,max(case when V19CP95 =#{condition.count} then V_19 else null end) V_19_CP95,
max(V_20_MAX) V_20_MAX,min(V_20_MIN) V_20_MIN,round(avg(V_20) ,2) V_20,max(case when V20CP95 =#{condition.count} then V_20 else null end) V_20_CP95,
max(V_21_MAX) V_21_MAX,min(V_21_MIN) V_21_MIN,round(avg(V_21) ,2) V_21,max(case when V21CP95 =#{condition.count} then V_21 else null end) V_21_CP95,
max(V_22_MAX) V_22_MAX,min(V_22_MIN) V_22_MIN,round(avg(V_22) ,2) V_22,max(case when V22CP95 =#{condition.count} then V_22 else null end) V_22_CP95,
max(V_23_MAX) V_23_MAX,min(V_23_MIN) V_23_MIN,round(avg(V_23) ,2) V_23,max(case when V23CP95 =#{condition.count} then V_23 else null end) V_23_CP95,
max(V_24_MAX) V_24_MAX,min(V_24_MIN) V_24_MIN,round(avg(V_24) ,2) V_24,max(case when V24CP95 =#{condition.count} then V_24 else null end) V_24_CP95,
max(V_25_MAX) V_25_MAX,min(V_25_MIN) V_25_MIN,round(avg(V_25) ,2) V_25,max(case when V25CP95 =#{condition.count} then V_25 else null end) V_25_CP95,
max(V_26_MAX) V_26_MAX,min(V_26_MIN) V_26_MIN,round(avg(V_26) ,2) V_26,max(case when V26CP95 =#{condition.count} then V_26 else null end) V_26_CP95,
max(V_27_MAX) V_27_MAX,min(V_27_MIN) V_27_MIN,round(avg(V_27) ,2) V_27,max(case when V27CP95 =#{condition.count} then V_27 else null end) V_27_CP95,
max(V_28_MAX) V_28_MAX,min(V_28_MIN) V_28_MIN,round(avg(V_28) ,2) V_28,max(case when V28CP95 =#{condition.count} then V_28 else null end) V_28_CP95,
max(V_29_MAX) V_29_MAX,min(V_29_MIN) V_29_MIN,round(avg(V_29) ,2) V_29,max(case when V29CP95 =#{condition.count} then V_29 else null end) V_29_CP95,
max(V_30_MAX) V_30_MAX,min(V_30_MIN) V_30_MIN,round(avg(V_30) ,2) V_30,max(case when V30CP95 =#{condition.count} then V_30 else null end) V_30_CP95,
max(V_31_MAX) V_31_MAX,min(V_31_MIN) V_31_MIN,round(avg(V_31) ,2) V_31,max(case when V31CP95 =#{condition.count} then V_31 else null end) V_31_CP95,
max(V_32_MAX) V_32_MAX,min(V_32_MIN) V_32_MIN,round(avg(V_32) ,2) V_32,max(case when V32CP95 =#{condition.count} then V_32 else null end) V_32_CP95,
max(V_33_MAX) V_33_MAX,min(V_33_MIN) V_33_MIN,round(avg(V_33) ,2) V_33,max(case when V33CP95 =#{condition.count} then V_33 else null end) V_33_CP95,
max(V_34_MAX) V_34_MAX,min(V_34_MIN) V_34_MIN,round(avg(V_34) ,2) V_34,max(case when V34CP95 =#{condition.count} then V_34 else null end) V_34_CP95,
max(V_35_MAX) V_35_MAX,min(V_35_MIN) V_35_MIN,round(avg(V_35) ,2) V_35,max(case when V35CP95 =#{condition.count} then V_35 else null end) V_35_CP95,
max(V_36_MAX) V_36_MAX,min(V_36_MIN) V_36_MIN,round(avg(V_36) ,2) V_36,max(case when V36CP95 =#{condition.count} then V_36 else null end) V_36_CP95,
max(V_37_MAX) V_37_MAX,min(V_37_MIN) V_37_MIN,round(avg(V_37) ,2) V_37,max(case when V37CP95 =#{condition.count} then V_37 else null end) V_37_CP95,
max(V_38_MAX) V_38_MAX,min(V_38_MIN) V_38_MIN,round(avg(V_38) ,2) V_38,max(case when V38CP95 =#{condition.count} then V_38 else null end) V_38_CP95,
max(V_39_MAX) V_39_MAX,min(V_39_MIN) V_39_MIN,round(avg(V_39) ,2) V_39,max(case when V39CP95 =#{condition.count} then V_39 else null end) V_39_CP95,
max(V_40_MAX) V_40_MAX,min(V_40_MIN) V_40_MIN,round(avg(V_40) ,2) V_40,max(case when V40CP95 =#{condition.count} then V_40 else null end) V_40_CP95,
max(V_41_MAX) V_41_MAX,min(V_41_MIN) V_41_MIN,round(avg(V_41) ,2) V_41,max(case when V41CP95 =#{condition.count} then V_41 else null end) V_41_CP95,
max(V_42_MAX) V_42_MAX,min(V_42_MIN) V_42_MIN,round(avg(V_42) ,2) V_42,max(case when V42CP95 =#{condition.count} then V_42 else null end) V_42_CP95,
max(V_43_MAX) V_43_MAX,min(V_43_MIN) V_43_MIN,round(avg(V_43) ,2) V_43,max(case when V43CP95 =#{condition.count} then V_43 else null end) V_43_CP95,
max(V_44_MAX) V_44_MAX,min(V_44_MIN) V_44_MIN,round(avg(V_44) ,2) V_44,max(case when V44CP95 =#{condition.count} then V_44 else null end) V_44_CP95,
max(V_45_MAX) V_45_MAX,min(V_45_MIN) V_45_MIN,round(avg(V_45) ,2) V_45,max(case when V45CP95 =#{condition.count} then V_45 else null end) V_45_CP95,
max(V_46_MAX) V_46_MAX,min(V_46_MIN) V_46_MIN,round(avg(V_46) ,2) V_46,max(case when V46CP95 =#{condition.count} then V_46 else null end) V_46_CP95,
max(V_47_MAX) V_47_MAX,min(V_47_MIN) V_47_MIN,round(avg(V_47) ,2) V_47,max(case when V47CP95 =#{condition.count} then V_47 else null end) V_47_CP95,
max(V_48_MAX) V_48_MAX,min(V_48_MIN) V_48_MIN,round(avg(V_48) ,2) V_48,max(case when V48CP95 =#{condition.count} then V_48 else null end) V_48_CP95,
max(V_49_MAX) V_49_MAX,min(V_49_MIN) V_49_MIN,round(avg(V_49) ,2) V_49,max(case when V49CP95 =#{condition.count} then V_49 else null end) V_49_CP95,
max(V_50_MAX) V_50_MAX,min(V_50_MIN) V_50_MIN,round(avg(V_50) ,2) V_50,max(case when V50CP95 =#{condition.count} then V_50 else null end) V_50_CP95
from ( select t.*,
row_number() over (partition by phasic_type order by V_2 desc) V2CP95,
row_number() over (partition by phasic_type order by V_3 desc) V3CP95,
row_number() over (partition by phasic_type order by V_4 desc) V4CP95,
row_number() over (partition by phasic_type order by V_5 desc) V5CP95,
row_number() over (partition by phasic_type order by V_6 desc) V6CP95,
row_number() over (partition by phasic_type order by V_7 desc) V7CP95,
row_number() over (partition by phasic_type order by V_8 desc) V8CP95,
row_number() over (partition by phasic_type order by V_9 desc) V9CP95,
row_number() over (partition by phasic_type order by V_10 desc) V10CP95,
row_number() over (partition by phasic_type order by V_11 desc) V11CP95,
row_number() over (partition by phasic_type order by V_12 desc) V12CP95,
row_number() over (partition by phasic_type order by V_13 desc) V13CP95,
row_number() over (partition by phasic_type order by V_14 desc) V14CP95,
row_number() over (partition by phasic_type order by V_15 desc) V15CP95,
row_number() over (partition by phasic_type order by V_16 desc) V16CP95,
row_number() over (partition by phasic_type order by V_17 desc) V17CP95,
row_number() over (partition by phasic_type order by V_18 desc) V18CP95,
row_number() over (partition by phasic_type order by V_19 desc) V19CP95,
row_number() over (partition by phasic_type order by V_20 desc) V20CP95,
row_number() over (partition by phasic_type order by V_21 desc) V21CP95,
row_number() over (partition by phasic_type order by V_22 desc) V22CP95,
row_number() over (partition by phasic_type order by V_23 desc) V23CP95,
row_number() over (partition by phasic_type order by V_24 desc) V24CP95,
row_number() over (partition by phasic_type order by V_25 desc) V25CP95,
row_number() over (partition by phasic_type order by V_26 desc) V26CP95,
row_number() over (partition by phasic_type order by V_27 desc) V27CP95,
row_number() over (partition by phasic_type order by V_28 desc) V28CP95,
row_number() over (partition by phasic_type order by V_29 desc) V29CP95,
row_number() over (partition by phasic_type order by V_30 desc) V30CP95,
row_number() over (partition by phasic_type order by V_31 desc) V31CP95,
row_number() over (partition by phasic_type order by V_32 desc) V32CP95,
row_number() over (partition by phasic_type order by V_33 desc) V33CP95,
row_number() over (partition by phasic_type order by V_34 desc) V34CP95,
row_number() over (partition by phasic_type order by V_35 desc) V35CP95,
row_number() over (partition by phasic_type order by V_36 desc) V36CP95,
row_number() over (partition by phasic_type order by V_37 desc) V37CP95,
row_number() over (partition by phasic_type order by V_38 desc) V38CP95,
row_number() over (partition by phasic_type order by V_39 desc) V39CP95,
row_number() over (partition by phasic_type order by V_40 desc) V40CP95,
row_number() over (partition by phasic_type order by V_41 desc) V41CP95,
row_number() over (partition by phasic_type order by V_42 desc) V42CP95,
row_number() over (partition by phasic_type order by V_43 desc) V43CP95,
row_number() over (partition by phasic_type order by V_44 desc) V44CP95,
row_number() over (partition by phasic_type order by V_45 desc) V45CP95,
row_number() over (partition by phasic_type order by V_46 desc) V46CP95,
row_number() over (partition by phasic_type order by V_47 desc) V47CP95,
row_number() over (partition by phasic_type order by V_48 desc) V48CP95,
row_number() over (partition by phasic_type order by V_49 desc) V49CP95,
row_number() over (partition by phasic_type order by V_50 desc) V50CP95
from
<choose>
<when test="condition.b == true">
Data_HarmRate_V
</when>
<otherwise>
Day_HarmRate_V
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getFirstHarmonic" resultType="ReportValue">
SELECT PHASIC_TYPE PHASETYPE,
MAX(V_1_MAX) FMAXVALUE,MIN(V_1_MIN) MINVALUE,ROUND(AVG(V_1) ,2) MEANVALUE
,MAX(CASE WHEN V1CP95 =#{condition.count} THEN V_1 ELSE NULL END) CP95VALUE
FROM ( SELECT T.*,
ROW_NUMBER() OVER (PARTITION BY PHASIC_TYPE ORDER BY V_1 DESC) V1CP95
from
<choose>
<when test="condition.b == true">
Data_V
</when>
<otherwise>
Day_V
</otherwise>
</choose>
t where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
<if test="condition.b == true">
and QualityFlag = 0
</if>
<foreach collection="condition.exceptTime" index="index" item="item" open=" " separator=" " close="">
and timeid not between #{item.start} and #{item.end}
</foreach>) a
group by phasic_type
</select>
<select id="getHVoltageRate" resultType="java.util.HashMap">
SELECT PHASIC_TYPE PHASETYPE,TIMEID,
V_${condition.times}_MAX,V_${condition.times}_MIN,V_${condition.times},V_${condition.times}_CP95
from Day_HarmRate_V where lineid=#{condition.pointIndex} and phasic_type in ('A','B','C') and timeid between
#{condition.start}
and #{condition.end}
</select>
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.excelreport.PercentMapper">
<select id="getFpy" resultType="com.njcn.pojo.data.LimitRate">
SELECT
SUM(UHARM_2_OVERTIME) UHARM2OVERTIME,SUM(IHARM_2_OVERTIME) IHARM2OVERTIME,
SUM(UHARM_3_OVERTIME) UHARM3OVERTIME,SUM(IHARM_3_OVERTIME) IHARM3OVERTIME,
SUM(UHARM_4_OVERTIME) UHARM4OVERTIME,SUM(IHARM_4_OVERTIME) IHARM4OVERTIME,
SUM(UHARM_5_OVERTIME) UHARM5OVERTIME,SUM(IHARM_5_OVERTIME) IHARM5OVERTIME,
SUM(UHARM_6_OVERTIME) UHARM6OVERTIME,SUM(IHARM_6_OVERTIME) IHARM6OVERTIME,
SUM(UHARM_7_OVERTIME) UHARM7OVERTIME,SUM(IHARM_7_OVERTIME) IHARM7OVERTIME,
SUM(UHARM_8_OVERTIME) UHARM8OVERTIME,SUM(IHARM_8_OVERTIME) IHARM8OVERTIME,
SUM(UHARM_9_OVERTIME) UHARM9OVERTIME,SUM(IHARM_9_OVERTIME) IHARM9OVERTIME,
SUM(UHARM_10_OVERTIME) UHARM10OVERTIME,SUM(IHARM_10_OVERTIME) IHARM10OVERTIME,
SUM(UHARM_11_OVERTIME) UHARM11OVERTIME,SUM(IHARM_11_OVERTIME) IHARM11OVERTIME,
SUM(UHARM_12_OVERTIME) UHARM12OVERTIME,SUM(IHARM_12_OVERTIME) IHARM12OVERTIME,
SUM(UHARM_13_OVERTIME) UHARM13OVERTIME,SUM(IHARM_13_OVERTIME) IHARM13OVERTIME,
SUM(UHARM_14_OVERTIME) UHARM14OVERTIME,SUM(IHARM_14_OVERTIME) IHARM14OVERTIME,
SUM(UHARM_15_OVERTIME) UHARM15OVERTIME,SUM(IHARM_15_OVERTIME) IHARM15OVERTIME,
SUM(UHARM_16_OVERTIME) UHARM16OVERTIME,SUM(IHARM_16_OVERTIME) IHARM16OVERTIME,
SUM(UHARM_17_OVERTIME) UHARM17OVERTIME,SUM(IHARM_17_OVERTIME) IHARM17OVERTIME,
SUM(UHARM_18_OVERTIME) UHARM18OVERTIME,SUM(IHARM_18_OVERTIME) IHARM18OVERTIME,
SUM(UHARM_19_OVERTIME) UHARM19OVERTIME,SUM(IHARM_19_OVERTIME) IHARM19OVERTIME,
SUM(UHARM_20_OVERTIME) UHARM20OVERTIME,SUM(IHARM_20_OVERTIME) IHARM20OVERTIME,
SUM(UHARM_21_OVERTIME) UHARM21OVERTIME,SUM(IHARM_21_OVERTIME) IHARM21OVERTIME,
SUM(UHARM_22_OVERTIME) UHARM22OVERTIME,SUM(IHARM_22_OVERTIME) IHARM22OVERTIME,
SUM(UHARM_23_OVERTIME) UHARM23OVERTIME,SUM(IHARM_23_OVERTIME) IHARM23OVERTIME,
SUM(UHARM_24_OVERTIME) UHARM24OVERTIME,SUM(IHARM_24_OVERTIME) IHARM24OVERTIME,
SUM(UHARM_25_OVERTIME) UHARM25OVERTIME,SUM(IHARM_25_OVERTIME) IHARM25OVERTIME,
SUM(VOLTAGE_DEV_OVERTIME) VOLTAGEDEVOVERTIME,SUM(UABERRANCE_OVERTIME)
UABERRANCEOVERTIME,SUM(FREQ_DEV_OVERTIME) FREQDEVOVERTIME,SUM(FLICKET_ALLTIME)
FLICKETALLTIME,SUM(UBALANCE_OVERTIME) UBALANCEOVERTIME,SUM(ALLTIME) ALLTIME,SUM(FLICKER_OVERTIME) FLICKEROVERTIME FROM LIMIT_RATE
where timeid between #{start} and #{end} and myindex = #{pointIndex} and
Phasic_Type = 'T'
</select>
</mapper>

View File

@@ -0,0 +1,659 @@
<?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.pqs9000.mapper.responsibility.AreaOverNormalMapper">
<!-- 获取在线监测点、超标监测点和各指标超标监测点数 -->
<select id="getInfo" resultType="com.pqs9000.pojo.responsibility.AreaOverNoraml">
select
X.allLine onlineMonitorNumber,
Y.overLine overLimitMonitorNumber,
ROUND(case when X.allLine = 0 then 0 else Y.overLine/X.allLine*100 end,2) overBiLi,
P.frequencyOverLine frequencyMonitorNumber,
Q.voltageOverLine voltageMonitorNumber,
S.harmonicVoltageOverLine harmonicVoltageMonitorNumber,
R.harmonicCurrentOverLine harmonicCurrentMonitorNumber,
T.ubalanceOverLine threePhaseVoltageMonitorNumber,
Z.flicketOverLine flickerMonitorNumber,
A.negativeOverLine negativeMonitorNumber,
C.interharmonicOverLine interharmonicMonitorNumber
from
(
select
count(distinct myindex) allLine
from
limit_target
where
myindex IN
<foreach collection="list" item="list1" open="(" close=")" separator=",">
#{list1}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and phasic_type = 'T'
) X,
(
SELECT
COUNT(DISTINCT(MYINDEX)) overLine
FROM
limit_target b1,
PQS_DEPTSLINE b2,
PQS_DEPTS b3
WHERE
b1.PHASIC_TYPE = 'T'
AND b1.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND b1.MYINDEX IN
<foreach collection="list" item="list2" open="(" close=")" separator=",">
#{list2}
</foreach>
AND b1.MYINDEX = b2.LINE_INDEX AND b2.DEPTS_INDEX = b3.DEPTS_INDEX AND b3.CUSTOM_DEPT = 0
AND (b1.flicker_overtime >0 or b1.ubalance_overtime >0 or b1.freq_dev_overtime >0 or b1.uaberrance_overtime >0 or b1.voltage_dev_overtime >0 or b1.uharm_2_overtime >0 or b1.iharm_2_overtime >0 or b1.uharm_3_overtime >0 or b1.iharm_3_overtime >0 or b1.uharm_4_overtime >0 or b1.iharm_4_overtime >0
or b1.uharm_5_overtime >0 or b1.iharm_5_overtime >0 or b1.uharm_6_overtime >0 or b1.iharm_6_overtime >0 or b1.uharm_7_overtime >0 or b1.iharm_7_overtime >0
or b1.uharm_8_overtime >0 or b1.iharm_8_overtime >0 or b1.uharm_9_overtime >0 or b1.iharm_9_overtime >0 or b1.uharm_10_overtime >0 or b1.iharm_10_overtime >0
or b1.uharm_11_overtime >0 or b1.iharm_11_overtime >0 or b1.uharm_12_overtime >0 or b1.iharm_12_overtime >0 or b1.uharm_13_overtime >0 or b1.iharm_13_overtime >0
or b1.uharm_14_overtime >0 or b1.iharm_14_overtime >0 or b1.uharm_15_overtime >0 or b1.iharm_15_overtime >0 or b1.uharm_16_overtime >0 or b1.iharm_16_overtime >0
or b1.uharm_17_overtime >0 or b1.iharm_17_overtime >0 or b1.uharm_18_overtime >0 or b1.iharm_18_overtime >0 or b1.uharm_19_overtime >0 or b1.iharm_19_overtime >0
or b1.uharm_20_overtime >0 or b1.iharm_20_overtime >0 or b1.uharm_21_overtime >0 or b1.iharm_24_overtime >0 or b1.uharm_22_overtime >0 or b1.iharm_22_overtime >0
or b1.uharm_23_overtime >0 or b1.iharm_23_overtime >0 or b1.uharm_24_overtime >0 or b1.iharm_24_overtime >0 or b1.uharm_25_overtime >0 or b1.iharm_25_overtime >0
or b1.I_NEG_OVERTIME > 0 or b1.INUHARM_1_OVERTIME >0 or b1.INUHARM_2_OVERTIME >0 or b1.INUHARM_3_OVERTIME >0 or b1.INUHARM_4_OVERTIME >0 or b1.INUHARM_5_OVERTIME >0
or b1.INUHARM_6_OVERTIME >0 or b1.INUHARM_7_OVERTIME >0 or b1.INUHARM_8_OVERTIME >0 or b1.INUHARM_9_OVERTIME >0 or b1.INUHARM_10_OVERTIME >0 or b1.INUHARM_11_OVERTIME >0
or b1.INUHARM_12_OVERTIME >0 or b1.INUHARM_13_OVERTIME >0 or b1.INUHARM_14_OVERTIME >0 or b1.INUHARM_15_OVERTIME >0 or b1.INUHARM_16_OVERTIME >0)
) Y,
(
select
count(distinct myindex) frequencyOverLine
from
limit_target
where
myindex IN
<foreach collection="list" item="list3" open="(" close=")" separator=",">
#{list3}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and phasic_type = 'T' and FREQ_DEV_OVERTIME > 0
) P,
(select
count(distinct myindex) voltageOverLine
from
limit_target
where
myindex IN
<foreach collection="list" item="list4" open="(" close=")" separator=",">
#{list4}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and phasic_type = 'T' and VOLTAGE_DEV_OVERTIME > 0
) Q,
(
select
count(distinct c.myindex) harmonicVoltageOverLine
from
limit_target c
where
c.myindex in
<foreach collection="list" item="harmonicVoltageList" open="(" close=")" separator=",">
#{harmonicVoltageList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and (UABERRANCE_OVERTIME+UHARM_2_OVERTIME+UHARM_3_OVERTIME+UHARM_4_OVERTIME+UHARM_5_OVERTIME+UHARM_6_OVERTIME+UHARM_7_OVERTIME+UHARM_8_OVERTIME+UHARM_9_OVERTIME+UHARM_10_OVERTIME+UHARM_11_OVERTIME+UHARM_12_OVERTIME+UHARM_13_OVERTIME+UHARM_14_OVERTIME+UHARM_15_OVERTIME+UHARM_16_OVERTIME+UHARM_17_OVERTIME+UHARM_18_OVERTIME+UHARM_19_OVERTIME+UHARM_20_OVERTIME+UHARM_21_OVERTIME++UHARM_22_OVERTIME+UHARM_23_OVERTIME+UHARM_24_OVERTIME+UHARM_25_OVERTIME) > 0
) S,
(
select
count(distinct c.myindex) harmonicCurrentOverLine
from
limit_target c
where
c.myindex in
<foreach collection="list" item="harmonicCurrentList" open="(" close=")" separator=",">
#{harmonicCurrentList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and (IHARM_2_OVERTIME+IHARM_3_OVERTIME+IHARM_4_OVERTIME+IHARM_5_OVERTIME+IHARM_6_OVERTIME+IHARM_7_OVERTIME+IHARM_8_OVERTIME+IHARM_9_OVERTIME+IHARM_10_OVERTIME+IHARM_11_OVERTIME+IHARM_12_OVERTIME+IHARM_13_OVERTIME+IHARM_14_OVERTIME+IHARM_15_OVERTIME+IHARM_16_OVERTIME+IHARM_17_OVERTIME+IHARM_18_OVERTIME+IHARM_19_OVERTIME+IHARM_20_OVERTIME+IHARM_21_OVERTIME+IHARM_22_OVERTIME+IHARM_23_OVERTIME+IHARM_24_OVERTIME+IHARM_25_OVERTIME) > 0
) R,
(
select
count(distinct c.myindex) ubalanceOverLine
from
limit_target c
where
c.myindex in
<foreach collection="list" item="threePhaseVoltageList" open="(" close=")" separator=",">
#{threePhaseVoltageList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and UBALANCE_OVERTIME>0
) T,
(
select
count(distinct c.myindex) flicketOverLine
from
limit_target c
where
c.myindex in
<foreach collection="list" item="flickerList" open="(" close=")" separator=",">
#{flickerList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and FLICKER_OVERTIME > 0
) Z,
(
select
count(distinct c.myindex) negativeOverLine
from
limit_target c
where
c.myindex in
<foreach collection="list" item="negativeList" open="(" close=")" separator=",">
#{negativeList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and I_Neg_OverTime > 0
) A,
(
select
count(distinct c.myindex) interharmonicOverLine
from
limit_target c
where
c.myindex in
<foreach collection="list" item="harmonicCurrentList" open="(" close=")" separator=",">
#{harmonicCurrentList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and (InUHARM_1_OverTime+InUHARM_2_OverTime+InUHARM_3_OverTime+InUHARM_4_OverTime+InUHARM_5_OverTime+InUHARM_6_OverTime+InUHARM_7_OverTime+InUHARM_8_OverTime+InUHARM_9_OverTime+InUHARM_10_OverTime+InUHARM_11_OverTime+InUHARM_12_OverTime+InUHARM_13_OverTime+InUHARM_14_OverTime+InUHARM_15_OverTime+InUHARM_16_OverTime) > 0
) C
</select>
<!-- 国网监测点 -->
<select id="getCountryMonitor" resultType="int">
SELECT LINE_INDEX FROM PQ_LINEDETAIL WHERE MONITOR_ID is NOT NULL
AND LINE_INDEX IN
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
</select>
<select id="getFrequency" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
c.TIMEID,NVL(count(distinct c.myindex),0) overTotal
from
limit_target c
where
c.myindex in
<foreach collection="list" item="frequencyList" open="(" close=")" separator=",">
#{frequencyList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and FREQ_DEV_OVERTIME > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getVoltage" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
c.TIMEID,NVL(count(distinct c.myindex),0) overTotal
from
limit_target c
where
c.myindex in
<foreach collection="list" item="voltageList" open="(" close=")" separator=",">
#{voltageList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and VOLTAGE_DEV_OVERTIME > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getHarmonicVoltage" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
c.TIMEID,NVL(count(distinct c.myindex), 0) overTotal
from
limit_target c
where
c.myindex in
<foreach collection="list" item="harmonicVoltageList" open="(" close=")" separator=",">
#{harmonicVoltageList}
</foreach>
AND c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and (UABERRANCE_OVERTIME+UHARM_2_OVERTIME+UHARM_3_OVERTIME+UHARM_4_OVERTIME+UHARM_5_OVERTIME+UHARM_6_OVERTIME+UHARM_7_OVERTIME+UHARM_8_OVERTIME+UHARM_9_OVERTIME+UHARM_10_OVERTIME+UHARM_11_OVERTIME+UHARM_12_OVERTIME+UHARM_13_OVERTIME+UHARM_14_OVERTIME+UHARM_15_OVERTIME+UHARM_16_OVERTIME+UHARM_17_OVERTIME+UHARM_18_OVERTIME+UHARM_19_OVERTIME+UHARM_20_OVERTIME+UHARM_21_OVERTIME++UHARM_22_OVERTIME+UHARM_23_OVERTIME+UHARM_24_OVERTIME+UHARM_25_OVERTIME) > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getHarmonicCurrent" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
count(distinct c.myindex) overTotal,c.timeid
from
limit_target c
where
c.myindex in
<foreach collection="list" item="harmonicCurrentList" open="(" close=")" separator=",">
#{harmonicCurrentList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and (IHARM_2_OVERTIME+IHARM_3_OVERTIME+IHARM_4_OVERTIME+IHARM_5_OVERTIME+IHARM_6_OVERTIME+IHARM_7_OVERTIME+IHARM_8_OVERTIME+IHARM_9_OVERTIME+IHARM_10_OVERTIME+IHARM_11_OVERTIME+IHARM_12_OVERTIME+IHARM_13_OVERTIME+IHARM_14_OVERTIME+IHARM_15_OVERTIME+IHARM_16_OVERTIME+IHARM_17_OVERTIME+IHARM_18_OVERTIME+IHARM_19_OVERTIME+IHARM_20_OVERTIME+IHARM_21_OVERTIME+IHARM_22_OVERTIME+IHARM_23_OVERTIME+IHARM_24_OVERTIME+IHARM_25_OVERTIME) > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getThreePhaseVoltage" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
count(distinct c.myindex) overTotal,c.timeid
from
limit_target c
where
c.myindex in
<foreach collection="list" item="threePhaseVoltageList" open="(" close=")" separator=",">
#{threePhaseVoltageList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and UBALANCE_OVERTIME>0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getFlicker" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
c.timeid,NVL(count(distinct c.myindex),0) overTotal
from
limit_target c
where
c.myindex in
<foreach collection="list" item="flickerList" open="(" close=")" separator=",">
#{flickerList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and FLICKER_OVERTIME > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getNegative" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
count(distinct c.myindex) overTotal,c.timeid
from
limit_target c
where
c.myindex in
<foreach collection="list" item="negativeList" open="(" close=")" separator=",">
#{negativeList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and I_Neg_OverTime > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getInterharmonic" resultType="com.pqs9000.pojo.responsibility.OverLimitByDays">
SELECT A.TIMEID totalDate,B.allOver overCounts,A.overTotal FROM
(
select
c.timeid,NVL(count(distinct c.myindex),0) overTotal
from
limit_target c
where
c.myindex in
<foreach collection="list" item="harmonicCurrentList" open="(" close=")" separator=",">
#{harmonicCurrentList}
</foreach>
and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
and c.phasic_type = 'T' and (InUHARM_1_OverTime+InUHARM_2_OverTime+InUHARM_3_OverTime+InUHARM_4_OverTime+InUHARM_5_OverTime+InUHARM_6_OverTime+InUHARM_7_OverTime+InUHARM_8_OverTime+InUHARM_9_OverTime+InUHARM_10_OverTime+InUHARM_11_OverTime+InUHARM_12_OverTime+InUHARM_13_OverTime+InUHARM_14_OverTime+InUHARM_15_OverTime+InUHARM_16_OverTime) > 0
group by c.timeid
) A,
(
SELECT
TIMEID,NVL(COUNT(DISTINCT(MYINDEX)),0) allOver
FROM
limit_target
WHERE
MYINDEX in
<foreach collection="list" item="list" open="(" close=")" separator=",">
#{list}
</foreach>
AND PHASIC_TYPE = 'T'
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
group by TIMEID
) B
WHERE A.TIMEID = B.TIMEID ORDER BY A.TIMEID asc
</select>
<select id="getTypeList" resultType="map">
SELECT B.DIC_NAME,A.LOADTYPE FROM PQ_LINEDETAIL A,PQS_DICDATA B
WHERE A.LINE_INDEX IN
<foreach collection="list" item="totalList" open="(" close=")" separator=",">
#{totalList}
</foreach>
AND A.LOADTYPE = B.DIC_INDEX GROUP BY A.LOADTYPE,B.DIC_NAME
</select>
<select id="getMonitorByType" resultType="int">
SELECT
LINE_INDEX
FROM PQ_LINEDETAIL
WHERE LINE_INDEX IN
<foreach collection="list" item="totalList" open="(" close=")" separator=",">
#{totalList}
</foreach>
AND LOADTYPE = #{type}
</select>
<select id="getVolList" resultType="map">
SELECT A.SCALE,B.DIC_NAME FROM PQ_LINE A,PQS_DICDATA B WHERE A.SCALE = B.DIC_INDEX AND A.LINE_INDEX IN
<foreach collection="list" item="totalList" open="(" close=")" separator=",">
#{totalList}
</foreach>
GROUP BY A.SCALE,B.DIC_NAME
</select>
<select id="getMonitorByVol" resultType="int">
SELECT LINE_INDEX FROM PQ_LINE WHERE SCALE = #{type} AND LINE_INDEX IN
<foreach collection="list" item="totalList" open="(" close=")" separator=",">
#{totalList}
</foreach>
</select>
<select id="getAvg" resultType="com.pqs9000.pojo.responsibility.AreaOverNoraml">
SELECT
ROUND(AVG(NVL(B.frequencyOverLine,0)/A.count)*100,2) frequencyAvg,
ROUND(AVG(NVL(C.voltageOverLine,0)/A.count)*100,2) voltageAvg,
ROUND(AVG(NVL(D.harmonicVoltageOverLine,0)/A.count)*100,2) harmonicVoltageAvg,
ROUND(AVG(NVL(E.harmonicCurrentOverLine,0)/A.count)*100,2) harmonicCurrentAvg,
ROUND(AVG(NVL(F.ubalanceOverLine,0)/A.count)*100,2) threePhaseVoltageAvg,
ROUND(AVG(NVL(G.flicketOverLine,0)/A.count)*100,2) flickerAvg,
ROUND(AVG(NVL(H.negativeOverLine,0)/A.count)*100,2) negativeAvg,
ROUND(AVG(NVL(I.interharmonicOverLine,0)/A.count)*100,2) interharmonicAvg
FROM
/*计算每天在线监测点数据*/
(
SELECT
TIMEID,
COUNT(MYINDEX) count
FROM
LIMIT_TARGET
WHERE
myindex IN
<foreach collection="list" item="list1" open="(" close=")" separator=",">
#{list1}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
GROUP BY TIMEID
) A
LEFT JOIN
/*计算每天频率偏差超标监测点数据*/
(
SELECT
TIMEID,
count(myindex) frequencyOverLine
FROM
limit_target
WHERE
myindex IN
<foreach collection="list" item="list2" open="(" close=")" separator=",">
#{list2}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND phasic_type = 'T'
AND FREQ_DEV_OVERTIME > 0
GROUP BY TIMEID
) B
ON A.TIMEID = B.TIMEID
LEFT JOIN
/*计算每天电压偏差超标监测点数据*/
(
SELECT
TIMEID,
count(myindex) voltageOverLine
FROM
limit_target
WHERE
myindex IN
<foreach collection="list" item="list3" open="(" close=")" separator=",">
#{list3}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND phasic_type = 'T'
AND VOLTAGE_DEV_OVERTIME > 0
GROUP BY TIMEID
) C
ON A.TIMEID = C.TIMEID
LEFT JOIN
/*计算每天谐波电压超标监测点数据*/
(
SELECT
TIMEID,
count(c.myindex) harmonicVoltageOverLine
FROM
limit_target c
WHERE
myindex IN
<foreach collection="list" item="list4" open="(" close=")" separator=",">
#{list4}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND c.phasic_type = 'T'
AND (UABERRANCE_OVERTIME + UHARM_2_OVERTIME + UHARM_3_OVERTIME + UHARM_4_OVERTIME + UHARM_5_OVERTIME + UHARM_6_OVERTIME + UHARM_7_OVERTIME + UHARM_8_OVERTIME + UHARM_9_OVERTIME + UHARM_10_OVERTIME + UHARM_11_OVERTIME + UHARM_12_OVERTIME + UHARM_13_OVERTIME + UHARM_14_OVERTIME + UHARM_15_OVERTIME + UHARM_16_OVERTIME + UHARM_17_OVERTIME + UHARM_18_OVERTIME + UHARM_19_OVERTIME + UHARM_20_OVERTIME + UHARM_21_OVERTIME ++ UHARM_22_OVERTIME + UHARM_23_OVERTIME + UHARM_24_OVERTIME + UHARM_25_OVERTIME) > 0
GROUP BY TIMEID
) D
ON A.TIMEID = D.TIMEID
LEFT JOIN
/*计算每天谐波电流超标监测点数据*/
(
SELECT
TIMEID,
count(c.myindex) harmonicCurrentOverLine
FROM
limit_target c
WHERE
myindex IN
<foreach collection="list" item="list5" open="(" close=")" separator=",">
#{list5}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND c.phasic_type = 'T'
AND (IHARM_2_OVERTIME + IHARM_3_OVERTIME + IHARM_4_OVERTIME + IHARM_5_OVERTIME + IHARM_6_OVERTIME + IHARM_7_OVERTIME + IHARM_8_OVERTIME + IHARM_9_OVERTIME + IHARM_10_OVERTIME + IHARM_11_OVERTIME + IHARM_12_OVERTIME + IHARM_13_OVERTIME + IHARM_14_OVERTIME + IHARM_15_OVERTIME + IHARM_16_OVERTIME + IHARM_17_OVERTIME + IHARM_18_OVERTIME + IHARM_19_OVERTIME + IHARM_20_OVERTIME + IHARM_21_OVERTIME + IHARM_22_OVERTIME + IHARM_23_OVERTIME + IHARM_24_OVERTIME + IHARM_25_OVERTIME) > 0
GROUP BY TIMEID
) E
ON A.TIMEID = E.TIMEID
LEFT JOIN
/*计算每天三相电压不平衡度超标监测点数据*/
(
SELECT
TIMEID,
count(c.myindex) ubalanceOverLine
FROM
limit_target c
WHERE
myindex IN
<foreach collection="list" item="list6" open="(" close=")" separator=",">
#{list6}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND c.phasic_type = 'T'
AND UBALANCE_OVERTIME>0
GROUP BY TIMEID
) F
ON A.TIMEID = F.TIMEID
LEFT JOIN
/*计算每天闪变超标监测点数据*/
(
SELECT
TIMEID,
count(c.myindex) flicketOverLine
FROM
limit_target c
WHERE
myindex IN
<foreach collection="list" item="list7" open="(" close=")" separator=",">
#{list7}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND c.phasic_type = 'T'
AND FLICKER_OVERTIME > 0
GROUP BY TIMEID
) G
ON A.TIMEID = G.TIMEID
LEFT JOIN
/*计算每天负序电流监测点数据*/
(
SELECT
TIMEID,
count(c.myindex) negativeOverLine
FROM
limit_target c
WHERE
myindex IN
<foreach collection="list" item="list8" open="(" close=")" separator=",">
#{list8}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND c.phasic_type = 'T'
AND I_Neg_OverTime > 0
GROUP BY TIMEID
) H
ON A.TIMEID = H.TIMEID
LEFT JOIN
/*计算每天间谐波电压监测点数据*/
(
SELECT
TIMEID,
count(c.myindex) interharmonicOverLine
FROM
limit_target c
WHERE
myindex IN
<foreach collection="list" item="list9" open="(" close=")" separator=",">
#{list9}
</foreach>
and timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND c.phasic_type = 'T'
AND (InUHARM_1_OverTime + InUHARM_2_OverTime + InUHARM_3_OverTime + InUHARM_4_OverTime + InUHARM_5_OverTime + InUHARM_6_OverTime + InUHARM_7_OverTime + InUHARM_8_OverTime + InUHARM_9_OverTime + InUHARM_10_OverTime + InUHARM_11_OverTime + InUHARM_12_OverTime + InUHARM_13_OverTime + InUHARM_14_OverTime + InUHARM_15_OverTime + InUHARM_16_OverTime) > 0
GROUP BY TIMEID
) I
ON A.TIMEID = I.TIMEID
</select>
</mapper>

View File

@@ -0,0 +1,72 @@
<?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.pqs9000.mapper.responsibility.DataHarmonicDetailMapper">
<delete id="deleteData">
DELETE
FROM
DATA_HARMONIC_DETAIL
WHERE
TIME_ID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
</delete>
<insert id="insertData" parameterType="java.util.List" databaseId="Oracle">
insert into DATA_HARMONIC_DETAIL (
<foreach collection="list" item="item" index="index" separator="UNION ALL">
select #{item.timeId},#{item.lineId},#{item.targetType},#{item.maxData},#{item.limitData},#{item.diffData} from dual
</foreach>
)
</insert>
<select id="selectMaxData" resultType="com.pqs9000.pojo.data.DataHarmonicDetail">
SELECT
*
FROM
(
SELECT
t.*,
ROW_NUMBER() OVER (PARTITION BY t.LINE_ID,t.TARGET_TYPE,t.MAX_DATA
ORDER BY t.LINE_ID) AS rn
FROM
(
SELECT
A.LINE_ID ,
A.TARGET_TYPE ,
A.MAX_DATA ,
A.LIMIT_DATA ,
A.DIFF_DATA
FROM
DATA_HARMONIC_DETAIL A
RIGHT JOIN
(
SELECT
LINE_ID,
TARGET_TYPE,
MAX(MAX_DATA) maxData
FROM
DATA_HARMONIC_DETAIL
WHERE
TIME_ID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
GROUP BY
LINE_ID ,
TARGET_TYPE
)
B ON
A.LINE_ID = B.LINE_ID
AND A.TARGET_TYPE = B.TARGET_TYPE
AND A.MAX_DATA = B.maxData
<if test="list != null and list.size()>0">
<where>
B.LINE_ID IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</where>
</if>
) t
)
WHERE
rn = 1
</select>
</mapper>

View File

@@ -0,0 +1,835 @@
<?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.pqs9000.mapper.responsibility.OverLimitMonitorMapper">
<select id="getOverLimitMonitorList" resultType="com.pqs9000.pojo.responsibility.OverLimitMonitor">
SELECT * from
(
SELECT
primary.LINE_INDEX monitorId,
primary.NAME monitorName,
primary.cityCompany,
primary.provinceCompany,
primary.MONITORVOLTAGELEVEL,
primary.PLANTNAME,
primary.PLANTVOLAGELEVEL,
primary.objName,
primary.powerSubstationName,
primary.DLCMP dlcMp,
primary.DEVCMP devcMp,
primary.XYCMP xycMp,
NVL(A.OVERTIMES, 0) overLimitDay,
NVL(B.OVERTIMES, 0) overFrequencyDeviationDay,
NVL(C.OVERTIMES, 0) overVoltageDeviationDay,
NVL(harmV.OVERTIMES,0) overLimitHarmVDay,
NVL(D.OVERTIMES, 0) overVoltageDistortionDay,
NVL(E.OVERTIMES, 0) overHarmonicVoltageDay,
NVL(F.OVERTIMES, 0) overHarmonicCurrentDay,
NVL(G.OVERTIMES, 0) overVoltageThreeTimes,
NVL(H.OVERTIMES, 0) overVoltageFiveTimes,
NVL(I.OVERTIMES, 0) overVoltageSevenTimes,
NVL(J.OVERTIMES, 0) overVoltageElevenTimes,
NVL(K.OVERTIMES, 0) overVoltageThirteenTimes,
NVL(L.OVERTIMES, 0) overVoltageTwentyThirdTimes,
NVL(M.OVERTIMES, 0) overVoltageTwentyFiveTimes,
NVL(N.OVERTIMES, 0) overVoltageOtherTimes,
NVL(O.OVERTIMES, 0) overCurrentThreeTimes,
NVL(P.OVERTIMES, 0) overCurrentFiveTimes,
NVL(Q.OVERTIMES, 0) overCurrentSevenTimes,
NVL(R.OVERTIMES, 0) overCurrentElevenTimes,
NVL(S.OVERTIMES, 0) overCurrentThirteenTimes,
NVL(T.OVERTIMES, 0) overCurrentTwentyThirdTimes,
NVL(U.OVERTIMES, 0) overCurrentTwentyFiveTimes,
NVL(V.OVERTIMES, 0) overCurrentOtherTimes,
NVL(W.OVERTIMES, 0) overThreeVoltageUnbalanceDay,
NVL(X.OVERTIMES, 0) overFlickerDay,
Y.monitorType,
Y.monitorNumber,
NVL(Z.OVERTIMES, 0) overNegativeDay,
NVL(interharmonics.OVERTIMES, 0) overInterharmonicsDay
FROM
(
SELECT
fir.LINE LINE_INDEX,
fir.NAME,
fir.objName,
fir.DLCMP ,
fir.DEVCMP ,
fir.XYCMP ,
A.DIC_NAME cityCompany,
B.DEPTSNAME provinceCompany,
C.DIC_NAME MONITORVOLTAGELEVEL,
fir.SUBNAME PLANTNAME,
fir.powerSubstationName,
D.DIC_NAME PLANTVOLAGELEVEL
FROM
(
SELECT
DISTINCT(A.LINE_INDEX) line,
A.NAME,
A.DLCMP ,
A.DEVCMP ,
A.XYCMP ,
C.AREA,
C.PARENTNODEID,
A.SCALE lineScale,
D.NAME subName,
D.SCALE subScale,
E.objname objName,
E.POWER_SUBSTATION_NAME powerSubstationName
FROM
PQ_LINE A,
PQS_DEPTSLINE B,
PQS_DEPTS C,
PQ_SUBSTATION D,
PQ_LINEDETAIL E
WHERE A.LINE_INDEX IN
<foreach collection="list" item="list1" open="(" close=")" separator=",">
#{list1}
</foreach>
AND A.LINE_INDEX = B.LINE_INDEX
AND B.DEPTS_INDEX = C.DEPTS_INDEX
<!-- 不限制部门类型 0:非自定义部门 1:自定义部门-->
<!-- AND C.CUSTOM_DEPT = 0 -->
AND c.state = 1
AND A.SUB_INDEX = D.SUB_INDEX
AND A.LINE_INDEX = E.LINE_INDEX
<if test=" vollevel != ''">
AND A.SCALE=#{vollevel}
</if>
) fir
LEFT JOIN
PQS_DICDATA A
ON fir.AREA = A.DIC_INDEX
LEFT JOIN
PQS_DEPTS B
ON fir.PARENTNODEID = B.DEPTS_INDEX
LEFT JOIN
PQS_DICDATA C
ON fir.lineScale = C.DIC_INDEX
LEFT JOIN
PQS_DICDATA D
ON fir.SUBSCALE = D.DIC_INDEX
ORDER BY fir.LINE
) primary
LEFT JOIN
(SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list2" open="(" close=")" separator=",">
#{list2}
</foreach>
and (flicker_overtime >0 or ubalance_overtime >0 or freq_dev_overtime >0 or uaberrance_overtime >0 or voltage_dev_overtime >0 or uharm_2_overtime >0 or iharm_2_overtime >0 or uharm_3_overtime >0 or iharm_3_overtime >0 or uharm_4_overtime >0 or iharm_4_overtime >0
or uharm_5_overtime >0 or iharm_5_overtime >0 or uharm_6_overtime >0 or iharm_6_overtime >0 or uharm_7_overtime >0 or iharm_7_overtime >0
or uharm_8_overtime >0 or iharm_8_overtime >0 or uharm_9_overtime >0 or iharm_9_overtime >0 or uharm_10_overtime >0 or iharm_10_overtime >0
or uharm_11_overtime >0 or iharm_11_overtime >0 or uharm_12_overtime >0 or iharm_12_overtime >0 or uharm_13_overtime >0 or iharm_13_overtime >0
or uharm_14_overtime >0 or iharm_14_overtime >0 or uharm_15_overtime >0 or iharm_15_overtime >0 or uharm_16_overtime >0 or iharm_16_overtime >0
or uharm_17_overtime >0 or iharm_17_overtime >0 or uharm_18_overtime >0 or iharm_18_overtime >0 or uharm_19_overtime >0 or iharm_19_overtime >0
or uharm_20_overtime >0 or iharm_20_overtime >0 or uharm_21_overtime >0 or iharm_24_overtime >0 or uharm_22_overtime >0 or iharm_22_overtime >0
or uharm_23_overtime >0 or iharm_23_overtime >0 or uharm_24_overtime >0 or iharm_24_overtime >0 or uharm_25_overtime >0 or iharm_25_overtime >0
or I_NEG_OVERTIME > 0 or INUHARM_1_OVERTIME >0 or INUHARM_2_OVERTIME >0 or INUHARM_3_OVERTIME >0 or INUHARM_4_OVERTIME >0 or INUHARM_5_OVERTIME >0
or INUHARM_6_OVERTIME >0 or INUHARM_7_OVERTIME >0 or INUHARM_8_OVERTIME >0 or INUHARM_9_OVERTIME >0 or INUHARM_10_OVERTIME >0 or INUHARM_11_OVERTIME >0
or INUHARM_12_OVERTIME >0 or INUHARM_13_OVERTIME >0 or INUHARM_14_OVERTIME >0 or INUHARM_15_OVERTIME >0 or INUHARM_16_OVERTIME >0
) GROUP BY MYINDEX
)A
ON primary.LINE_INDEX = A.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list3" open="(" close=")" separator=",">
#{list3}
</foreach>
and freq_dev_overtime >0 GROUP BY MYINDEX
) B
ON primary.LINE_INDEX = B.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list4" open="(" close=")" separator=",">
#{list4}
</foreach>
and voltage_dev_overtime >0 GROUP BY MYINDEX
) C
ON primary.LINE_INDEX = C.MYINDEX
LEFT JOIN
(select MYINDEX,COUNT(1) overTimes
from limit_target
where phasic_type = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list4" open="(" close=")"
separator=",">
#{list4}
</foreach>
and (uaberrance_overtime > 0 or uharm_2_overtime > 0 or
uharm_3_overtime > 0 or uharm_4_overtime > 0 or
uharm_5_overtime > 0 or uharm_6_overtime > 0 or
uharm_7_overtime > 0 or uharm_8_overtime > 0 or
uharm_9_overtime > 0 or uharm_10_overtime > 0 or
uharm_11_overtime > 0 or uharm_12_overtime > 0 or
uharm_13_overtime > 0 or uharm_14_overtime > 0 or
uharm_15_overtime > 0 or uharm_16_overtime > 0 or
uharm_17_overtime > 0 or uharm_18_overtime > 0 or
uharm_19_overtime > 0 or uharm_20_overtime > 0 or
uharm_21_overtime > 0 or uharm_22_overtime > 0 or
uharm_23_overtime > 0 or uharm_24_overtime > 0 or
uharm_25_overtime > 0) GROUP BY MYINDEX
) harmV
ON primary.LINE_INDEX = harmV.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list5" open="(" close=")" separator=",">
#{list5}
</foreach>
and uaberrance_overtime >0 GROUP BY MYINDEX
) D
ON primary.LINE_INDEX = D.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list6" open="(" close=")" separator=",">
#{list6}
</foreach>
and (uharm_2_overtime >0 or uharm_3_overtime >0 or uharm_4_overtime >0 or uharm_5_overtime >0 or uharm_6_overtime >0 or uharm_7_overtime >0 or uharm_8_overtime >0 or uharm_9_overtime >0 or uharm_10_overtime >0 or uharm_11_overtime >0 or uharm_12_overtime >0 or uharm_13_overtime >0 or uharm_14_overtime >0 or uharm_15_overtime >0 or uharm_16_overtime >0 or uharm_17_overtime >0 or uharm_18_overtime >0 or uharm_19_overtime >0 or uharm_20_overtime >0 or uharm_21_overtime >0 or uharm_22_overtime >0 or uharm_23_overtime >0 or uharm_24_overtime >0 or uharm_25_overtime >0) GROUP BY MYINDEX
) E
ON primary.LINE_INDEX = E.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list7" open="(" close=")" separator=",">
#{list7}
</foreach>
and (iharm_2_overtime >0 or iharm_3_overtime >0 or iharm_4_overtime >0 or iharm_5_overtime >0 or iharm_6_overtime >0 or iharm_7_overtime >0 or iharm_8_overtime >0 or iharm_9_overtime >0 or iharm_10_overtime >0 or iharm_11_overtime >0 or iharm_12_overtime >0 or iharm_13_overtime >0 or iharm_14_overtime >0 or iharm_15_overtime >0 or iharm_16_overtime >0 or iharm_17_overtime >0 or iharm_18_overtime >0 or iharm_19_overtime >0 or iharm_20_overtime >0 or iharm_21_overtime >0 or iharm_22_overtime >0 or iharm_23_overtime >0 or iharm_24_overtime >0 or iharm_25_overtime >0) GROUP BY MYINDEX
) F
ON primary.LINE_INDEX = F.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list8" open="(" close=")" separator=",">
#{list8}
</foreach>
and uharm_3_overtime >0 GROUP BY MYINDEX
) G
ON primary.LINE_INDEX = G.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list9" open="(" close=")" separator=",">
#{list9}
</foreach>
and uharm_5_overtime >0 GROUP BY MYINDEX
) H
ON primary.LINE_INDEX = H.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list10" open="(" close=")" separator=",">
#{list10}
</foreach>
and uharm_7_overtime >0 GROUP BY MYINDEX
) I
ON primary.LINE_INDEX = I.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list11" open="(" close=")" separator=",">
#{list11}
</foreach>
and uharm_11_overtime >0 GROUP BY MYINDEX
) J
ON primary.LINE_INDEX = J.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list12" open="(" close=")" separator=",">
#{list12}
</foreach>
and uharm_13_overtime >0 GROUP BY MYINDEX
) K
ON primary.LINE_INDEX = K.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list13" open="(" close=")" separator=",">
#{list13}
</foreach>
and uharm_23_overtime >0 GROUP BY MYINDEX
) L
ON primary.LINE_INDEX = L.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list14" open="(" close=")" separator=",">
#{list14}
</foreach>
and uharm_25_overtime >0 GROUP BY MYINDEX
) M
ON primary.LINE_INDEX = M.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,SUM(uharm_2_overtime + uharm_4_overtime + uharm_6_overtime + uharm_8_overtime + uharm_9_overtime + uharm_10_overtime + uharm_12_overtime + uharm_14_overtime + uharm_15_overtime + uharm_16_overtime + uharm_17_overtime + uharm_18_overtime + uharm_19_overtime + uharm_20_overtime + uharm_21_overtime + uharm_22_overtime + uharm_24_overtime) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list15" open="(" close=")" separator=",">
#{list15}
</foreach>
and (uharm_2_overtime >0 or uharm_4_overtime >0 or uharm_6_overtime >0 or uharm_8_overtime >0 or uharm_9_overtime >0 or uharm_10_overtime >0 or uharm_12_overtime >0 or uharm_14_overtime >0 or uharm_15_overtime >0 or uharm_16_overtime >0 or uharm_17_overtime >0 or uharm_18_overtime >0 or uharm_19_overtime >0 or uharm_20_overtime >0 or uharm_21_overtime >0 or uharm_22_overtime >0 or uharm_24_overtime >0) GROUP BY MYINDEX
) N
ON primary.LINE_INDEX = N.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list16" open="(" close=")" separator=",">
#{list16}
</foreach>
and iharm_3_overtime >0 GROUP BY MYINDEX
) O
ON primary.LINE_INDEX = O.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list17" open="(" close=")" separator=",">
#{list17}
</foreach>
and iharm_5_overtime >0 GROUP BY MYINDEX
) P
ON primary.LINE_INDEX = P.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list18" open="(" close=")" separator=",">
#{list18}
</foreach>
and iharm_7_overtime >0 GROUP BY MYINDEX
) Q
ON primary.LINE_INDEX = Q.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list19" open="(" close=")" separator=",">
#{list19}
</foreach>
and iharm_11_overtime >0 GROUP BY MYINDEX
) R
ON primary.LINE_INDEX = R.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list20" open="(" close=")" separator=",">
#{list20}
</foreach>
and iharm_13_overtime >0 GROUP BY MYINDEX
) S
ON primary.LINE_INDEX = S.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list21" open="(" close=")" separator=",">
#{list21}
</foreach>
and iharm_23_overtime >0 GROUP BY MYINDEX
) T
ON primary.LINE_INDEX = T.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list22" open="(" close=")" separator=",">
#{list22}
</foreach>
and iharm_25_overtime >0 GROUP BY MYINDEX
) U
ON primary.LINE_INDEX = U.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,SUM(iharm_2_overtime + iharm_4_overtime + iharm_6_overtime + iharm_8_overtime + iharm_9_overtime + iharm_10_overtime + iharm_12_overtime + iharm_14_overtime + iharm_15_overtime + iharm_16_overtime + iharm_17_overtime + iharm_18_overtime + iharm_19_overtime + iharm_20_overtime + iharm_21_overtime + iharm_22_overtime + iharm_24_overtime) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list23" open="(" close=")" separator=",">
#{list23}
</foreach>
and (iharm_2_overtime >0 or iharm_4_overtime >0 or iharm_6_overtime >0 or iharm_8_overtime >0 or iharm_9_overtime >0 or iharm_10_overtime >0 or iharm_12_overtime >0 or iharm_14_overtime >0 or iharm_15_overtime >0 or iharm_16_overtime >0 or iharm_17_overtime >0 or iharm_18_overtime >0 or iharm_19_overtime >0 or iharm_20_overtime >0 or iharm_21_overtime >0 or iharm_22_overtime >0 or iharm_24_overtime >0) GROUP BY MYINDEX
) V
ON primary.LINE_INDEX = V.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list24" open="(" close=")" separator=",">
#{list24}
</foreach>
and ubalance_overtime >0 GROUP BY MYINDEX
) W
ON primary.LINE_INDEX = W.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list25" open="(" close=")" separator=",">
#{list25}
</foreach>
and flicker_overtime >0 GROUP BY MYINDEX
) X
ON primary.LINE_INDEX = X.MYINDEX
LEFT JOIN
(
SELECT
pqld.LINE_INDEX MYINDEX,
pd.DIC_NAME monitorType,
pqld.MONITOR_ID monitorNumber
FROM PQ_LINEDETAIL pqld,PQS_DICDATA pd WHERE LINE_INDEX IN
<foreach collection="list" item="list26" open="(" close=")" separator=",">
#{list26}
</foreach>
AND pqld.LOADTYPE = pd.DIC_INDEX
) Y
ON primary.LINE_INDEX = Y.MYINDEX
LEFT JOIN
(
SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND MYINDEX IN
<foreach collection="list" item="list27" open="(" close=")" separator=",">
#{list27}
</foreach>
and I_Neg_OverTime >0 GROUP BY MYINDEX
) Z
ON primary.LINE_INDEX = Z.MYINDEX
LEFT JOIN
(SELECT
MYINDEX,COUNT(1) overTimes
FROM
limit_target
WHERE
PHASIC_TYPE = 'T' AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') AND
MYINDEX IN
<foreach collection="list" item="list28" open="(" close=")" separator=",">
#{list28}
</foreach>
and (InUHARM_1_OverTime >0 or InUHARM_2_OverTime >0 or InUHARM_3_OverTime >0 or InUHARM_4_OverTime >0 or InUHARM_5_OverTime >0 or InUHARM_6_OverTime >0
or InUHARM_7_OverTime >0 or InUHARM_8_OverTime >0 or InUHARM_9_OverTime >0 or InUHARM_10_OverTime >0 or InUHARM_11_OverTime >0 or InUHARM_12_OverTime >0
or InUHARM_13_OverTime >0 or InUHARM_14_OverTime >0 or InUHARM_15_OverTime >0 or InUHARM_16_OverTime >0) GROUP BY MYINDEX) interharmonics
ON primary.LINE_INDEX = interharmonics.MYINDEX
ORDER BY primary.provinceCompany,primary.cityCompany,primary.NAME
) where overLimitDay >0
</select>
<select id="getLineList" resultType="java.lang.String">
SELECT
DISTINCT MYINDEX
FROM
LIMIT_TARGET
WHERE
(ALLTIME &gt; 0 OR FLICKET_ALLTIME &gt; 0)
AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
</select>
<select id="getData1" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
max(abs(A.VU_DEV_MAX)) maxVoltageDeviationData,
B.VOLTAGE_DEV limitVoltageDeviationData,
max(abs(A.VU_DEV_MAX))-B.VOLTAGE_DEV diffVoltageDeviationData,
max(A.V_THD_CP95) maxVoltageDistortionData,
B.UBALANCE limitVoltageDistortionData,
max(A.V_THD_CP95)-B.UBALANCE diffVoltageDistortionData,
max(A.V_UNBALANCE_CP95) maxThreeVoltageUnbalanceData,
B.UABERRANCE limitThreeVoltageUnbalanceData,
max(A.V_UNBALANCE_CP95)-B.UABERRANCE diffThreeVoltageUnbalanceData,
max(abs(A.FREQ_DEV_MAX)) maxFrequencyDeviationData,
B.FREQ_DEV limitFrequencyDeviationData,
max(abs(A.FREQ_DEV_MAX))-B.FREQ_DEV diffFrequencyDeviationData
FROM
DATA_V A
RIGHT JOIN OVERLIMIT B ON A.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY A.LINEID,B.VOLTAGE_DEV,B.UBALANCE,B.UABERRANCE,B.FREQ_DEV
</select>
<select id="getData2" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
max(A.I_NEG_CP95) maxNegativeDay,
B.I_NEG limitNegativeData,
max(A.I_NEG_CP95)-B.I_NEG diffNegativeData
FROM
DATA_I A
RIGHT JOIN OVERLIMIT B ON A.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY A.LINEID,B.I_NEG
</select>
<select id="getData3" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
max(A.PLT) maxFlickerData,
B.FLICKER limitFlickerData,
max(A.PLT)-B.FLICKER diffFlickerData
FROM
DATA_PLT A
RIGHT JOIN OVERLIMIT B ON A.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY A.LINEID,B.FLICKER
</select>
<select id="getData4" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
MAX(A.I_2_CP95/NULLIF(B.IHARM_2,0)) ratio1,
MAX(A.I_3_CP95/NULLIF(B.IHARM_3,0)) ratio2,
MAX(A.I_4_CP95/NULLIF(B.IHARM_4,0)) ratio3,
MAX(A.I_5_CP95/NULLIF(B.IHARM_5,0)) ratio4,
MAX(A.I_6_CP95/NULLIF(B.IHARM_6,0)) ratio5,
MAX(A.I_7_CP95/NULLIF(B.IHARM_7,0)) ratio6,
MAX(A.I_8_CP95/NULLIF(B.IHARM_8,0)) ratio7,
MAX(A.I_9_CP95/NULLIF(B.IHARM_9,0)) ratio8,
MAX(A.I_10_CP95/NULLIF(B.IHARM_10,0)) ratio9,
MAX(A.I_11_CP95/NULLIF(B.IHARM_11,0)) ratio10,
MAX(A.I_12_CP95/NULLIF(B.IHARM_12,0)) ratio11,
MAX(A.I_13_CP95/NULLIF(B.IHARM_13,0)) ratio12,
MAX(A.I_14_CP95/NULLIF(B.IHARM_14,0)) ratio13,
MAX(A.I_15_CP95/NULLIF(B.IHARM_15,0)) ratio14,
MAX(A.I_16_CP95/NULLIF(B.IHARM_16,0)) ratio15,
MAX(A.I_17_CP95/NULLIF(B.IHARM_17,0)) ratio16,
MAX(A.I_18_CP95/NULLIF(B.IHARM_18,0)) ratio17,
MAX(A.I_19_CP95/NULLIF(B.IHARM_19,0)) ratio18,
MAX(A.I_20_CP95/NULLIF(B.IHARM_20,0)) ratio19,
MAX(A.I_21_CP95/NULLIF(B.IHARM_21,0)) ratio20,
MAX(A.I_22_CP95/NULLIF(B.IHARM_22,0)) ratio21,
MAX(A.I_23_CP95/NULLIF(B.IHARM_23,0)) ratio22,
MAX(A.I_24_CP95/NULLIF(B.IHARM_24,0)) ratio23,
MAX(A.I_25_CP95/NULLIF(B.IHARM_25,0)) ratio24
FROM
DATA_I A
RIGHT JOIN OVERLIMIT B ON A.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY A.LINEID
</select>
<select id="getData5" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
MAX(A.V_THD_CP95/NULLIF(B.UBALANCE,0)) ratio1,
MAX(C.V_2_CP95/NULLIF(B.UHARM_2,0)) ratio2,
MAX(C.V_3_CP95/NULLIF(B.UHARM_3,0)) ratio3,
MAX(C.V_4_CP95/NULLIF(B.UHARM_4,0)) ratio4,
MAX(C.V_5_CP95/NULLIF(B.UHARM_5,0)) ratio5,
MAX(C.V_6_CP95/NULLIF(B.UHARM_6,0)) ratio6,
MAX(C.V_7_CP95/NULLIF(B.UHARM_7,0)) ratio7,
MAX(C.V_8_CP95/NULLIF(B.UHARM_8,0)) ratio8,
MAX(C.V_9_CP95/NULLIF(B.UHARM_9,0)) ratio9,
MAX(C.V_10_CP95/NULLIF(B.UHARM_10,0)) ratio10,
MAX(C.V_11_CP95/NULLIF(B.UHARM_11,0)) ratio11,
MAX(C.V_12_CP95/NULLIF(B.UHARM_12,0)) ratio12,
MAX(C.V_13_CP95/NULLIF(B.UHARM_13,0)) ratio13,
MAX(C.V_14_CP95/NULLIF(B.UHARM_14,0)) ratio14,
MAX(C.V_15_CP95/NULLIF(B.UHARM_15,0)) ratio15,
MAX(C.V_16_CP95/NULLIF(B.UHARM_16,0)) ratio16,
MAX(C.V_17_CP95/NULLIF(B.UHARM_17,0)) ratio17,
MAX(C.V_18_CP95/NULLIF(B.UHARM_18,0)) ratio18,
MAX(C.V_19_CP95/NULLIF(B.UHARM_19,0)) ratio19,
MAX(C.V_20_CP95/NULLIF(B.UHARM_20,0)) ratio20,
MAX(C.V_21_CP95/NULLIF(B.UHARM_21,0)) ratio21,
MAX(C.V_22_CP95/NULLIF(B.UHARM_22,0)) ratio22,
MAX(C.V_23_CP95/NULLIF(B.UHARM_23,0)) ratio23,
MAX(C.V_24_CP95/NULLIF(B.UHARM_24,0)) ratio24,
MAX(C.V_25_CP95/NULLIF(B.UHARM_25,0)) ratio25
FROM
OVERLIMIT B
LEFT JOIN DATA_V A ON A.LINEID = B.MYINDEX
LEFT JOIN Data_HarmRate_V C ON C.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND A.TIMEID = C.TIMEID
GROUP BY A.LINEID
</select>
<select id="getData6" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
MAX(A.V_2_CP95/NULLIF(B.UHARM_2,0)) ratio2,
MAX(A.V_3_CP95/NULLIF(B.UHARM_3,0)) ratio3,
MAX(A.V_4_CP95/NULLIF(B.UHARM_4,0)) ratio4,
MAX(A.V_5_CP95/NULLIF(B.UHARM_5,0)) ratio5,
MAX(A.V_6_CP95/NULLIF(B.UHARM_6,0)) ratio6,
MAX(A.V_7_CP95/NULLIF(B.UHARM_7,0)) ratio7,
MAX(A.V_8_CP95/NULLIF(B.UHARM_8,0)) ratio8,
MAX(A.V_9_CP95/NULLIF(B.UHARM_9,0)) ratio9,
MAX(A.V_10_CP95/NULLIF(B.UHARM_10,0)) ratio10,
MAX(A.V_11_CP95/NULLIF(B.UHARM_11,0)) ratio11,
MAX(A.V_12_CP95/NULLIF(B.UHARM_12,0)) ratio12,
MAX(A.V_13_CP95/NULLIF(B.UHARM_13,0)) ratio13,
MAX(A.V_14_CP95/NULLIF(B.UHARM_14,0)) ratio14,
MAX(A.V_15_CP95/NULLIF(B.UHARM_15,0)) ratio15,
MAX(A.V_16_CP95/NULLIF(B.UHARM_16,0)) ratio16,
MAX(A.V_17_CP95/NULLIF(B.UHARM_17,0)) ratio17,
MAX(A.V_18_CP95/NULLIF(B.UHARM_18,0)) ratio18,
MAX(A.V_19_CP95/NULLIF(B.UHARM_19,0)) ratio19,
MAX(A.V_20_CP95/NULLIF(B.UHARM_20,0)) ratio20,
MAX(A.V_21_CP95/NULLIF(B.UHARM_21,0)) ratio21,
MAX(A.V_22_CP95/NULLIF(B.UHARM_22,0)) ratio22,
MAX(A.V_23_CP95/NULLIF(B.UHARM_23,0)) ratio23,
MAX(A.V_24_CP95/NULLIF(B.UHARM_24,0)) ratio24,
MAX(A.V_25_CP95/NULLIF(B.UHARM_25,0)) ratio25
FROM
Data_HarmRate_V A
RIGHT JOIN OVERLIMIT B ON A.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY A.LINEID
</select>
<select id="getData7" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.LINEID monitorId,
MAX(A.V_1_CP95/NULLIF(B.INUHARM_1,0)) ratio1,
MAX(A.V_2_CP95/NULLIF(B.INUHARM_2,0)) ratio2,
MAX(A.V_3_CP95/NULLIF(B.INUHARM_3,0)) ratio3,
MAX(A.V_4_CP95/NULLIF(B.INUHARM_4,0)) ratio4,
MAX(A.V_5_CP95/NULLIF(B.INUHARM_5,0)) ratio5,
MAX(A.V_6_CP95/NULLIF(B.INUHARM_6,0)) ratio6,
MAX(A.V_7_CP95/NULLIF(B.INUHARM_7,0)) ratio7,
MAX(A.V_8_CP95/NULLIF(B.INUHARM_8,0)) ratio8,
MAX(A.V_9_CP95/NULLIF(B.INUHARM_9,0)) ratio9,
MAX(A.V_10_CP95/NULLIF(B.INUHARM_10,0)) ratio10,
MAX(A.V_11_CP95/NULLIF(B.INUHARM_11,0)) ratio11,
MAX(A.V_12_CP95/NULLIF(B.INUHARM_12,0)) ratio12,
MAX(A.V_13_CP95/NULLIF(B.INUHARM_13,0)) ratio13,
MAX(A.V_14_CP95/NULLIF(B.INUHARM_14,0)) ratio14,
MAX(A.V_15_CP95/NULLIF(B.INUHARM_15,0)) ratio15,
MAX(A.V_16_CP95/NULLIF(B.INUHARM_16,0)) ratio16
FROM
Data_InHarm_V A
RIGHT JOIN OVERLIMIT B ON A.LINEID = B.MYINDEX
WHERE
A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
AND B.MYINDEX IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY A.LINEID
</select>
<select id="getHarmonicData1" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.MYINDEX monitorId,
A.IHARM_${time} data1,
MAX(B.I_${time}_CP95) data2
FROM
OVERLIMIT A
LEFT JOIN DATA_I B ON
A.MYINDEX = B.LINEID
WHERE
A.MYINDEX = #{lineId} AND B.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
GROUP BY A.MYINDEX,A.IHARM_${time}
</select>
<select id="getHarmonicData2" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.MYINDEX monitorId,
A.UBALANCE data1,
MAX(B.V_THD_CP95) data2
FROM
OVERLIMIT A
LEFT JOIN DATA_V B ON
A.MYINDEX = B.LINEID
WHERE
A.MYINDEX = #{lineId} AND B.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
GROUP BY A.MYINDEX,A.UBALANCE
</select>
<select id="getHarmonicData3" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.MYINDEX monitorId,
A.UHARM_${time} data1,
MAX(B.V_${time}_CP95) data2
FROM
OVERLIMIT A
LEFT JOIN Data_HarmRate_V B ON
A.MYINDEX = B.LINEID
WHERE
A.MYINDEX = #{lineId} AND B.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
GROUP BY A.MYINDEX,A.UHARM_${time}
</select>
<select id="getHarmonicData4" resultType="com.pqs9000.pojo.responsibility.TargetDetailDto">
SELECT
A.MYINDEX monitorId,
A.INUHARM_${time} data1,
MAX(B.V_${time}_CP95) data2
FROM
OVERLIMIT A
LEFT JOIN Data_InHarm_V B ON
A.MYINDEX = B.LINEID
WHERE
A.MYINDEX = #{lineId} AND B.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
GROUP BY A.MYINDEX,A.INUHARM_${time}
</select>
</mapper>

View File

@@ -0,0 +1,55 @@
<?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.pqs9000.mapper.responsibility.ResponsibilityDataMapper">
<select id="responsibilityDataList" resultType="ResponsibilityData">
select
*
from
pqs_responsibilityData
where
update_time between #{startTime} and #{endTime}
</select>
<select id="selectData" resultType="ResponsibilityData">
select
*
from
pqs_responsibilityData
where
line_index=#{lineName}
and
user_data=#{excelName}
and
time_win=#{timeWin}
and
res_type=#{type}
</select>
<delete id="deleteByResIndex">
delete
from
pqs_responsibilityData t1
where
t1.res_index=#{resIndex}
</delete>
<select id="getLimitU" resultType="float">
SELECT
t.UHARM_${time}
FROM
OVERLIMIT t
WHERE
MYINDEX = #{lineIndex}
</select>
<select id="getLimitI" resultType="float">
SELECT
t.IHARM_${time}
FROM
OVERLIMIT t
WHERE
MYINDEX = #{lineIndex}
</select>
</mapper>

View File

@@ -0,0 +1,26 @@
<?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.pqs9000.mapper.responsibility.UserExcelDataMapper">
<select id="selectUserExcelData" resultType="UserExcelData">
select
*
from
PQS_USEREXCELDATA T1
where
t1.excel_name=#{excelName}
and
t1.start_time=#{startTime}
and
t1.end_time=#{endTime}
</select>
<delete id="deleteByIndex">
delete
from
PQS_USEREXCELDATA t1
where
t1.EXCEL_INDEX=#{excelIndex}
</delete>
</mapper>

View File

@@ -0,0 +1,50 @@
<?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.pqs9000.mapper.responsibility.UserExcelDataNoIntegrityMapper">
<insert id="insertAll" useGeneratedKeys="false">
insert into PQS_USEREXCELDATANOINTERGRITY (
INTERGRITY_INDEX,
EXCEL_INDEX,
USER_NAME,
LINE_NO,
LACK_DATE,
INTERGRITY,
USER_NO
)(
<foreach collection ="list" item="userExcelDataNoIntegrity" index="index" separator="UNION ALL">
select
#{userExcelDataNoIntegrity.intergrityIndex},
#{userExcelDataNoIntegrity.excelIndex},
#{userExcelDataNoIntegrity.userName},
#{userExcelDataNoIntegrity.lineNo},
#{userExcelDataNoIntegrity.lackDate},
#{userExcelDataNoIntegrity.intergrity},
#{userExcelDataNoIntegrity.userNo}
from dual
</foreach >
)
</insert>
<delete id="deleteByExcelIndex" >
delete from PQS_USEREXCELDATANOINTERGRITY t1
where
t1.EXCEL_INDEX=#{excelIndex}
</delete>
<select id="getUserExcelDataNoIntergritys" resultType="userExcelDataNoIntegrity">
SELECT
T2.EXCEL_NAME EXCEL_INDEX,
T1.USER_NAME,
T1.LINE_NO,
T1.LACK_DATE,
T1.INTERGRITY
FROM
PQS_USEREXCELDATANOINTERGRITY t1,PQS_USEREXCELDATA t2
WHERE
T1.EXCEL_INDEX=T2.EXCEL_INDEX
AND
T1.EXCEL_INDEX=#{excelIndex}
</select>
</mapper>

View File

@@ -0,0 +1,464 @@
<?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.pqs9000.mapper.responsibility.WarningSubstationMapper">
<!-- <select id="getEachIndex" resultType="com.pqs9000.pojo.responsibility.WarningSubstation">-->
<!-- SELECT-->
<!-- area.DEPTSNAME provinceCompany,-->
<!-- area.DIC_NAME cityCompany,-->
<!-- sub.NAME plantName,-->
<!-- dicdata.DIC_NAME plantVoltageLevel,-->
<!-- basic.allLine onlineMonitorCounts,-->
<!-- basic.overLine alertMonitorCounts,-->
<!-- basic.aOverCounts+basic.bOverCounts+basic.cOverCounts+basic.dOverCounts+basic.eOverCounts+basic.fOverCounts+basic.gOverCounts+basic.hOverCounts+basic.iOverCounts+basic.xOverCounts+basic.yOverCounts alertCounts,-->
<!-- ROUND(case when overLine = 0 then 0 else (basic.aOverCounts+basic.bOverCounts+basic.cOverCounts+basic.dOverCounts+basic.eOverCounts+basic.fOverCounts+basic.gOverCounts+basic.hOverCounts+basic.iOverCounts+basic.xOverCounts+basic.yOverCounts)/overLine end,2) alertAlarmFrequency,-->
<!-- ROUND(case when basic.aOverTotal = 0 then 0 else basic.aOverCounts/aOverTotal end,2) frequencyDeviation,-->
<!-- ROUND(case when basic.bOverTotal = 0 then 0 else basic.bOverCounts/bOverTotal end,2) voltageDeviation,-->
<!-- ROUND(case when basic.cOverTotal = 0 then 0 else basic.cOverCounts/cOverTotal end,2) harmonicVoltage,-->
<!-- ROUND(case when basic.dOverTotal = 0 then 0 else basic.dOverCounts/dOverTotal end,2) harmonicCurrent,-->
<!-- ROUND(case when basic.eOverTotal = 0 then 0 else basic.eOverCounts/eOverTotal end,2) threePhaseVoltageUnbalance,-->
<!-- ROUND(case when basic.fOverTotal = 0 then 0 else basic.fOverCounts/fOverTotal end,2) flicker,-->
<!-- ROUND(case when basic.gOverTotal = 0 then 0 else basic.gOverCounts/gOverTotal end,2) shortInterruption,-->
<!-- ROUND(case when basic.hOverTotal = 0 then 0 else basic.hOverCounts/hOverTotal end,2) voltageDip,-->
<!-- ROUND(case when basic.iOverTotal = 0 then 0 else basic.iOverCounts/iOverTotal end,2) voltageSwell,-->
<!-- ROUND(case when basic.xOverTotal = 0 then 0 else basic.xOverCounts/xOverTotal end,2) interharmonic,-->
<!-- ROUND(case when basic.yOverTotal = 0 then 0 else basic.yOverCounts/yOverTotal end,2) negative-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- S.SUB_INDEX,-->
<!-- SUM(M.allLine) allLine,-->
<!-- SUM(NVL(N.overLine, 0)) overLine,-->
<!-- SUM(NVL(A.overCounts, 0)) aOverCounts,-->
<!-- SUM(NVL(A.overTotal, 0)) aOverTotal,-->
<!-- SUM(NVL(B.overCounts, 0)) bOverCounts,-->
<!-- SUM(NVL(B.overTotal, 0)) bOverTotal,-->
<!-- SUM(NVL(C.overCounts, 0)) cOverCounts,-->
<!-- SUM(NVL(C.overTotal, 0)) cOverTotal,-->
<!-- SUM(NVL(D.overCounts, 0)) dOverCounts,-->
<!-- SUM(NVL(D.overTotal, 0)) dOverTotal,-->
<!-- SUM(NVL(E.overCounts, 0)) eOverCounts,-->
<!-- SUM(NVL(E.overTotal, 0)) eOverTotal,-->
<!-- SUM(NVL(E.overCounts, 0)) fOverCounts,-->
<!-- SUM(NVL(E.overTotal, 0)) fOverTotal,-->
<!-- SUM(NVL(G.overCounts, 0)) gOverCounts,-->
<!-- SUM(NVL(G.overTotal, 0)) gOverTotal,-->
<!-- SUM(NVL(H.overCounts, 0)) hOverCounts,-->
<!-- SUM(NVL(H.overTotal, 0)) hOverTotal,-->
<!-- SUM(NVL(I.overCounts, 0)) iOverCounts,-->
<!-- SUM(NVL(I.overTotal, 0)) iOverTotal,-->
<!-- SUM(NVL(X.overCounts, 0)) xOverCounts,-->
<!-- SUM(NVL(X.overTotal, 0)) xOverTotal,-->
<!-- SUM(NVL(Y.overCounts, 0)) yOverCounts,-->
<!-- SUM(NVL(Y.overTotal, 0)) yOverTotal-->
<!-- FROM-->
<!-- (select-->
<!-- count(distinct c.myindex) allLine, c.myindex-->
<!-- from-->
<!-- limit_target c,-->
<!-- PQS_DICDATA dic,-->
<!-- PQ_SUBSTATION sub,-->
<!-- PQ_LINE line-->
<!-- where-->
<!-- c.myindex IN-->
<!-- <foreach collection="list" item="list1" open="(" close=")" separator=",">-->
<!-- #{list1}-->
<!-- </foreach>-->
<!-- and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and c.phasic_type = 'T'-->
<!-- <if test="level!=null and level!=''">-->
<!-- AND dic.DIC_INDEX = sub.SCALE AND dic.DIC_INDEX = #{level}-->
<!-- </if>-->
<!-- AND line.LINE_INDEX = c.MYINDEX AND line.SUB_INDEX = sub.SUB_INDEX GROUP BY c.myindex-->
<!-- UNION-->
<!-- SELECT-->
<!-- NVL(COUNT(DISTINCT(A.LINEID)), 0) overTotal,A.LINEID-->
<!-- FROM-->
<!-- PQS_EVENTDETAIL A,-->
<!-- PQ_SUBSTATION B,-->
<!-- PQ_LINE C-->
<!-- WHERE-->
<!-- A.WAVETYPE IN (1,2,3) AND A.TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- AND-->
<!-- A.LINEID IN-->
<!-- <foreach collection="list" item="a" open="(" close=")" separator=",">-->
<!-- #{a}-->
<!-- </foreach>-->
<!-- <if test="level!=null and level!=''">-->
<!-- AND-->
<!-- A.LINEID = C.LINE_INDEX AND C.SUB_INDEX = B.SUB_INDEX-->
<!-- AND-->
<!-- B.SCALE = #{level}-->
<!-- </if>-->
<!-- GROUP BY A.LINEID-->
<!-- ) M-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- SELECT NVL(COUNT(DISTINCT(MYINDEX)), 0) overLine,MYINDEX FROM limit_target WHERE PHASIC_TYPE = 'T'-->
<!-- AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- AND MYINDEX IN-->
<!-- <foreach collection="list" item="list2" open="(" close=")" separator=",">-->
<!-- #{list2}-->
<!-- </foreach>-->
<!-- AND (FREQ_DEV_OVERTIME>0 OR VOLTAGE_DEV_OVERTIME>0 OR UABERRANCE_OVERTIME>0 OR UHARM_2_OVERTIME>0 OR UHARM_3_OVERTIME>0 OR UHARM_4_OVERTIME>0 OR UHARM_5_OVERTIME>0 OR UHARM_6_OVERTIME>0 OR UHARM_7_OVERTIME>0 OR UHARM_8_OVERTIME>0 OR UHARM_9_OVERTIME>0 OR UHARM_10_OVERTIME>0 OR UHARM_11_OVERTIME>0 OR UHARM_12_OVERTIME>0 OR UHARM_13_OVERTIME>0 OR UHARM_14_OVERTIME>0 OR UHARM_15_OVERTIME>0 OR UHARM_16_OVERTIME>0 OR UHARM_17_OVERTIME>0 OR UHARM_18_OVERTIME>0 OR UHARM_19_OVERTIME>0 OR UHARM_20_OVERTIME>0 OR UHARM_21_OVERTIME>0 OR UHARM_22_OVERTIME>0 OR UHARM_23_OVERTIME>0 OR UHARM_24_OVERTIME>0 OR UHARM_25_OVERTIME>0 OR IHARM_2_OVERTIME>0 OR IHARM_3_OVERTIME>0 OR IHARM_4_OVERTIME>0 OR IHARM_5_OVERTIME>0 OR IHARM_6_OVERTIME>0 OR IHARM_7_OVERTIME>0 OR IHARM_8_OVERTIME>0 OR IHARM_9_OVERTIME>0 OR IHARM_10_OVERTIME>0 OR IHARM_11_OVERTIME>0 OR IHARM_12_OVERTIME>0 OR IHARM_13_OVERTIME>0 OR IHARM_14_OVERTIME>0 OR IHARM_15_OVERTIME>0 OR IHARM_16_OVERTIME>0 OR IHARM_17_OVERTIME>0 OR IHARM_18_OVERTIME>0 OR IHARM_19_OVERTIME>0 OR IHARM_20_OVERTIME>0 OR IHARM_21_OVERTIME>0 OR IHARM_22_OVERTIME>0 OR IHARM_23_OVERTIME>0 OR IHARM_24_OVERTIME>0 OR IHARM_25_OVERTIME>0 OR UBALANCE_OVERTIME>0 OR FLICKER_OVERTIME>0 OR I_NEG_OVERTIME>0 OR INUHARM_1_OVERTIME>0 OR INUHARM_2_OVERTIME>0 OR INUHARM_3_OVERTIME>0 OR INUHARM_4_OVERTIME>0 OR INUHARM_5_OVERTIME>0 OR INUHARM_6_OVERTIME>0 OR INUHARM_7_OVERTIME>0 OR INUHARM_8_OVERTIME>0 OR INUHARM_9_OVERTIME>0 OR INUHARM_10_OVERTIME>0 OR INUHARM_11_OVERTIME>0 OR INUHARM_12_OVERTIME>0 OR INUHARM_13_OVERTIME>0 OR INUHARM_14_OVERTIME>0 OR INUHARM_15_OVERTIME>0 OR INUHARM_16_OVERTIME>0) GROUP BY MYINDEX-->
<!-- UNION-->
<!-- SELECT-->
<!-- NVL(COUNT(DISTINCT(LINEID)), 0) overTotal,LINEID-->
<!-- FROM-->
<!-- PQS_EVENTDETAIL-->
<!-- WHERE-->
<!-- WAVETYPE IN (1,2,3) AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- AND LINEID IN-->
<!-- <foreach collection="list" item="b" open="(" close=")" separator=",">-->
<!-- #{b}-->
<!-- </foreach>-->
<!-- GROUP BY LINEID-->
<!-- ) N-->
<!-- ON M.MYINDEX = N.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- SELECT pqline.LINE_INDEX,sub.SUB_INDEX FROM PQ_SUBSTATION sub,PQ_LINE pqline,PQS_DICDATA dic-->
<!-- WHERE pqline.LINE_INDEX IN-->
<!-- <foreach collection="list" item="list3" open="(" close=")" separator=",">-->
<!-- #{list3}-->
<!-- </foreach>-->
<!-- AND pqline.SUB_INDEX = sub.SUB_INDEX AND sub.SCALE = dic.DIC_INDEX GROUP BY pqline.LINE_INDEX,sub.SUB_INDEX-->
<!-- ) S ON M.MYINDEX = S.LINE_INDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal, NVL(sum(Freq_Dev_OverTime), 0) overCounts,MYINDEX-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in-->
<!-- <foreach collection="list" item="list4" open="(" close=")" separator=",">-->
<!-- #{list4}-->
<!-- </foreach>-->
<!-- and-->
<!-- c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and-->
<!-- c.phasic_type = 'T' and FREQ_DEV_OVERTIME > 0 GROUP BY MYINDEX-->
<!-- ) A-->
<!-- ON M.MYINDEX = A.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal, NVL(sum(VOLTAGE_DEV_OVERTIME), 0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in-->
<!-- <foreach collection="list" item="list5" open="(" close=")" separator=",">-->
<!-- #{list5}-->
<!-- </foreach>-->
<!-- and-->
<!-- c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and-->
<!-- c.phasic_type = 'T' and VOLTAGE_DEV_OVERTIME > 0 GROUP BY c.myindex-->
<!-- ) B-->
<!-- ON M.MYINDEX = B.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal,NVL(sum(UABERRANCE_OVERTIME+UHARM_2_OVERTIME+UHARM_3_OVERTIME+UHARM_4_OVERTIME+ UHARM_5_OVERTIME+UHARM_6_OVERTIME+UHARM_7_OVERTIME+UHARM_8_OVERTIME+UHARM_9_OVERTIME+UHARM_10_OVERTIME+UHARM_11_OVERTIME+UHARM_12_OVERTIME+UHARM_13_OVERTIME+UHARM_14_OVERTIME+UHARM_15_OVERTIME+UHARM_16_OVERTIME+UHARM_17_OVERTIME+UHARM_18_OVERTIME+UHARM_19_OVERTIME+UHARM_20_OVERTIME+UHARM_21_OVERTIME++UHARM_22_OVERTIME+UHARM_23_OVERTIME+UHARM_24_OVERTIME+UHARM_25_OVERTIME),0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in-->
<!-- <foreach collection="list" item="list6" open="(" close=")" separator=",">-->
<!-- #{list6}-->
<!-- </foreach>-->
<!-- and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and c.phasic_type = 'T' and (UABERRANCE_OVERTIME>0 OR UHARM_2_OVERTIME>0 OR UHARM_3_OVERTIME>0 OR UHARM_4_OVERTIME>0 OR UHARM_5_OVERTIME>0 OR UHARM_6_OVERTIME>0 OR UHARM_7_OVERTIME>0 OR UHARM_8_OVERTIME>0 OR UHARM_9_OVERTIME>0 OR UHARM_10_OVERTIME>0 OR UHARM_11_OVERTIME>0 OR UHARM_12_OVERTIME>0 OR UHARM_13_OVERTIME>0 OR UHARM_14_OVERTIME>0 OR UHARM_15_OVERTIME>0 OR UHARM_16_OVERTIME>0 OR UHARM_17_OVERTIME>0 OR UHARM_18_OVERTIME>0 OR UHARM_19_OVERTIME>0 OR UHARM_20_OVERTIME>0 OR UHARM_21_OVERTIME>0 OR UHARM_22_OVERTIME>0 OR UHARM_23_OVERTIME>0 OR UHARM_24_OVERTIME>0 OR UHARM_25_OVERTIME>0) GROUP BY c.myindex-->
<!-- ) C-->
<!-- ON M.MYINDEX = C.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal,NVL(sum(IHARM_2_OVERTIME+IHARM_3_OVERTIME+IHARM_4_OVERTIME+IHARM_5_OVERTIME+IHARM_6_OVERTIME+IHARM_7_OVERTIME+IHARM_8_OVERTIME+IHARM_9_OVERTIME+IHARM_10_OVERTIME+IHARM_11_OVERTIME+IHARM_12_OVERTIME+IHARM_13_OVERTIME+IHARM_14_OVERTIME+IHARM_15_OVERTIME+IHARM_16_OVERTIME+IHARM_17_OVERTIME+IHARM_18_OVERTIME+IHARM_19_OVERTIME+IHARM_20_OVERTIME+IHARM_21_OVERTIME+IHARM_22_OVERTIME+IHARM_23_OVERTIME+IHARM_24_OVERTIME+IHARM_25_OVERTIME), 0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in <foreach collection="list" item="list7" open="(" close=")" separator=",">-->
<!-- #{list7}-->
<!-- </foreach>-->
<!-- and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and c.phasic_type = 'T' and (IHARM_2_OVERTIME>0 OR IHARM_3_OVERTIME>0 OR IHARM_4_OVERTIME>0 OR IHARM_5_OVERTIME>0 OR IHARM_6_OVERTIME>0 OR IHARM_7_OVERTIME>0 OR IHARM_8_OVERTIME>0 OR IHARM_9_OVERTIME>0 OR IHARM_10_OVERTIME>0 OR IHARM_11_OVERTIME>0 OR IHARM_12_OVERTIME>0 OR IHARM_13_OVERTIME>0 OR IHARM_14_OVERTIME>0 OR IHARM_15_OVERTIME>0 OR IHARM_16_OVERTIME>0 OR IHARM_17_OVERTIME>0 OR IHARM_18_OVERTIME>0 OR IHARM_19_OVERTIME>0 OR IHARM_20_OVERTIME>0 OR IHARM_21_OVERTIME>0 OR IHARM_22_OVERTIME>0 OR IHARM_23_OVERTIME>0 OR IHARM_24_OVERTIME>0 OR IHARM_25_OVERTIME>0) GROUP BY c.myindex-->
<!-- ) D-->
<!-- ON M.MYINDEX = D.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal,NVL(sum(UBALANCE_OVERTIME),0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in <foreach collection="list" item="list8" open="(" close=")" separator=",">-->
<!-- #{list8}-->
<!-- </foreach>-->
<!-- and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and c.phasic_type = 'T' and UBALANCE_OVERTIME>0 GROUP BY c.myindex-->
<!-- ) E-->
<!-- ON M.MYINDEX = E.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal,NVL(sum(FLICKER_OVERTIME),0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in <foreach collection="list" item="list9" open="(" close=")" separator=",">-->
<!-- #{list9}-->
<!-- </foreach>-->
<!-- and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and c.phasic_type = 'T' and FLICKER_OVERTIME>0 GROUP BY c.myindex-->
<!-- ) F-->
<!-- ON M.MYINDEX = F.MYINDEX-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- SELECT-->
<!-- NVL(COUNT(DISTINCT(LINEID)), 0) overTotal,NVL(COUNT(LINEID), 0) overCounts,LINEID-->
<!-- FROM-->
<!-- PQS_EVENTDETAIL-->
<!-- WHERE-->
<!-- WAVETYPE = 3-->
<!-- AND LINEID IN <foreach collection="list" item="list10" open="(" close=")" separator=",">-->
<!-- #{list10}-->
<!-- </foreach>-->
<!-- AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') GROUP BY LINEID-->
<!-- ) G-->
<!-- ON M.MYINDEX = G.LINEID-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- SELECT-->
<!-- NVL(COUNT(DISTINCT(LINEID)), 0) overTotal,NVL(COUNT(LINEID), 0) overCounts,LINEID-->
<!-- FROM-->
<!-- PQS_EVENTDETAIL-->
<!-- WHERE-->
<!-- WAVETYPE = 1-->
<!-- AND LINEID IN <foreach collection="list" item="list11" open="(" close=")" separator=",">-->
<!-- #{list11}-->
<!-- </foreach>-->
<!-- AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') GROUP BY LINEID-->
<!-- ) H-->
<!-- ON M.MYINDEX = H.LINEID-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- SELECT-->
<!-- NVL(COUNT(DISTINCT(LINEID)), 0) overTotal,NVL(COUNT(LINEID), 0) overCounts,LINEID-->
<!-- FROM-->
<!-- PQS_EVENTDETAIL-->
<!-- WHERE-->
<!-- WAVETYPE = 2-->
<!-- AND LINEID IN <foreach collection="list" item="list12" open="(" close=")" separator=",">-->
<!-- #{list12}-->
<!-- </foreach>-->
<!-- AND TIMEID BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') GROUP BY LINEID-->
<!-- ) I-->
<!-- ON M.MYINDEX = I.LINEID-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal,NVL(sum(InUHARM_1_OverTime+InUHARM_2_OverTime+InUHARM_3_OverTime+InUHARM_4_OverTime+InUHARM_5_OverTime+InUHARM_6_OverTime+InUHARM_7_OverTime+InUHARM_8_OverTime+InUHARM_9_OverTime+InUHARM_10_OverTime+InUHARM_11_OverTime+InUHARM_12_OverTime+InUHARM_13_OverTime+InUHARM_14_OverTime+InUHARM_15_OverTime+InUHARM_16_OverTime), 0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in <foreach collection="list" item="list13" open="(" close=")" separator=",">-->
<!-- #{list13}-->
<!-- </foreach>-->
<!-- and c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and c.phasic_type = 'T' and (INUHARM_1_OVERTIME>0 OR INUHARM_2_OVERTIME>0 OR INUHARM_3_OVERTIME>0 OR INUHARM_4_OVERTIME>0 OR INUHARM_5_OVERTIME>0 OR INUHARM_6_OVERTIME>0 OR INUHARM_7_OVERTIME>0 OR INUHARM_8_OVERTIME>0 OR INUHARM_9_OVERTIME>0 OR INUHARM_10_OVERTIME>0 OR INUHARM_11_OVERTIME>0 OR INUHARM_12_OVERTIME>0 OR INUHARM_13_OVERTIME>0 OR INUHARM_14_OVERTIME>0 OR INUHARM_15_OVERTIME>0 OR INUHARM_16_OVERTIME>0) GROUP BY c.myindex-->
<!-- ) X-->
<!-- ON M.MYINDEX = X.myindex-->
<!-- LEFT JOIN-->
<!-- (-->
<!-- select-->
<!-- count(distinct c.myindex) overTotal, NVL(sum(I_Neg_OverTime), 0) overCounts,c.myindex-->
<!-- from-->
<!-- limit_target c-->
<!-- where-->
<!-- c.myindex in <foreach collection="list" item="list14" open="(" close=")" separator=",">-->
<!-- #{list14}-->
<!-- </foreach>-->
<!-- and-->
<!-- c.timeid BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')-->
<!-- and-->
<!-- c.phasic_type = 'T' and I_Neg_OverTime > 0 GROUP BY c.myindex-->
<!-- ) Y-->
<!-- ON M.MYINDEX = Y.myindex-->
<!-- GROUP BY S.SUB_INDEX-->
<!-- ) basic,-->
<!-- PQ_SUBSTATION sub,-->
<!-- PQS_DICDATA dicdata,-->
<!-- (-->
<!-- SELECT A.SUB_INDEX,A.DIC_NAME,B.DEPTSNAME FROM-->
<!-- (-->
<!-- SELECT-->
<!-- D.SUB_INDEX,C.DIC_NAME,B.PARENTNODEID-->
<!-- FROM-->
<!-- PQS_DEPTSLINE A,-->
<!-- PQS_DEPTS B,-->
<!-- PQS_DICDATA C,-->
<!-- PQ_SUBSTATION D,-->
<!-- PQ_LINE E-->
<!-- WHERE-->
<!-- A.LINE_INDEX IN-->
<!-- <foreach collection="list" item="list15" open="(" close=")" separator=",">-->
<!-- #{list15}-->
<!-- </foreach>-->
<!-- AND A.DEPTS_INDEX = B.DEPTS_INDEX AND B.CUSTOM_DEPT = 0 AND B.AREA = C.DIC_INDEX AND A.LINE_INDEX = E.LINE_INDEX AND E.SUB_INDEX = D.SUB_INDEX GROUP BY D.SUB_INDEX-->
<!-- ,D.NAME,C.DIC_NAME,PARENTNODEID-->
<!-- )A,-->
<!-- PQS_DEPTS B-->
<!-- WHERE A.PARENTNODEID = DEPTS_INDEX-->
<!-- ) area-->
<!-- WHERE basic.SUB_INDEX = sub.SUB_INDEX AND sub.SCALE = dicdata.DIC_INDEX AND basic.SUB_INDEX = area.SUB_INDEX-->
<!-- AND (basic.aOverCounts+basic.bOverCounts+basic.cOverCounts+basic.dOverCounts+basic.eOverCounts+basic.fOverCounts+basic.gOverCounts+basic.hOverCounts+basic.iOverCounts+basic.xOverCounts+basic.yOverCounts) &gt;0 ORDER BY area.DEPTSNAME,area.DIC_NAME-->
<!-- </select>-->
<select id="getEachIndex" resultType="com.pqs9000.pojo.responsibility.WarningSubstation">
WITH t0 AS (
SELECT
MYINDEX,
--频率偏差
SUM( FREQ_DEV_OVERTIME ) frequencyDeviation,
--电压偏差
SUM( VOLTAGE_DEV_OVERTIME ) voltageDeviation,
--谐波电压
SUM(
UABERRANCE_OVERTIME + UHARM_2_OVERTIME + UHARM_3_OVERTIME + UHARM_4_OVERTIME + UHARM_5_OVERTIME + UHARM_6_OVERTIME + UHARM_7_OVERTIME + UHARM_8_OVERTIME + UHARM_9_OVERTIME + UHARM_10_OVERTIME + UHARM_11_OVERTIME + UHARM_12_OVERTIME + UHARM_13_OVERTIME + UHARM_14_OVERTIME + UHARM_15_OVERTIME + UHARM_16_OVERTIME + UHARM_17_OVERTIME + UHARM_18_OVERTIME + UHARM_19_OVERTIME + UHARM_20_OVERTIME + UHARM_21_OVERTIME ++ UHARM_22_OVERTIME + UHARM_23_OVERTIME + UHARM_24_OVERTIME + UHARM_25_OVERTIME
) harmonicVoltage,
--谐波电流
SUM(
IHARM_2_OVERTIME + IHARM_3_OVERTIME + IHARM_4_OVERTIME + IHARM_5_OVERTIME + IHARM_6_OVERTIME + IHARM_7_OVERTIME + IHARM_8_OVERTIME + IHARM_9_OVERTIME + IHARM_10_OVERTIME + IHARM_11_OVERTIME + IHARM_12_OVERTIME + IHARM_13_OVERTIME + IHARM_14_OVERTIME + IHARM_15_OVERTIME + IHARM_16_OVERTIME + IHARM_17_OVERTIME + IHARM_18_OVERTIME + IHARM_19_OVERTIME + IHARM_20_OVERTIME + IHARM_21_OVERTIME + IHARM_22_OVERTIME + IHARM_23_OVERTIME + IHARM_24_OVERTIME + IHARM_25_OVERTIME
) harmonicCurrent,
--三项电压不平衡度
SUM( UBALANCE_OVERTIME ) threePhaseVoltageUnbalance,
--闪变
SUM( FLICKER_OVERTIME ) flicker,
--负序电流
SUM( I_Neg_OverTime ) negative,
--间谐波电压
SUM(
InUHARM_1_OverTime + InUHARM_2_OverTime + InUHARM_3_OverTime + InUHARM_4_OverTime + InUHARM_5_OverTime + InUHARM_6_OverTime + InUHARM_7_OverTime + InUHARM_8_OverTime + InUHARM_9_OverTime + InUHARM_10_OverTime + InUHARM_11_OverTime + InUHARM_12_OverTime + InUHARM_13_OverTime + InUHARM_14_OverTime + InUHARM_15_OverTime + InUHARM_16_OverTime
) interharmonic
FROM
LIMIT_TARGET
WHERE
timeid BETWEEN TO_DATE( #{startTime}, 'yyyy-MM-dd' )
AND TO_DATE( #{endTime}, 'yyyy-MM-dd' )
AND myindex IN
<foreach collection="list" item="list1" open="(" close=")" separator=",">
#{list1}
</foreach>
GROUP BY
MYINDEX
),
t1 AS (
SELECT
LINEID,
SUM( CASE WHEN WAVETYPE = 1 THEN 1 ELSE 0 END ) voltageDip,
SUM( CASE WHEN WAVETYPE = 2 THEN 1 ELSE 0 END ) voltageSwell,
SUM( CASE WHEN WAVETYPE = 3 THEN 1 ELSE 0 END ) shortInterruption
FROM
PQS_EVENTDETAIL
WHERE
timeid BETWEEN TO_DATE( #{startTime}, 'yyyy-MM-dd' )
AND TO_DATE( #{endTime}, 'yyyy-MM-dd' )
AND WAVETYPE IN ( 1, 2, 3 )
AND LINEID IN
<foreach collection="list" item="list2" open="(" close=")" separator=",">
#{list2}
</foreach>
GROUP BY
LINEID
),
t2 AS (
SELECT
A.SUB_INDEX,
COUNT( MYINDEX ) onlineMonitorCounts,
SUM(
CASE
WHEN (
NVL( t0.FREQUENCYDEVIATION, 0 ) > 0
OR NVL( t0.voltageDeviation, 0 ) > 0
OR NVL( t0.harmonicVoltage, 0 ) > 0
OR NVL( t0.harmonicCurrent, 0 ) > 0
OR NVL( t0.threePhaseVoltageUnbalance, 0 ) > 0
OR NVL( t0.flicker, 0 ) > 0
OR NVL( t0.negative, 0 ) > 0
OR NVL( t0.interharmonic, 0 ) > 0
OR NVL( t1.SHORTINTERRUPTION, 0 ) > 0
OR NVL( t1.VOLTAGEDIP, 0 ) > 0
OR NVL( t1.VOLTAGESWELL, 0 ) > 0
) THEN
1 ELSE 0
END
) alertMonitorCounts,
SUM(
NVL( t0.FREQUENCYDEVIATION, 0 ) + NVL( t0.voltageDeviation, 0 ) + NVL( t0.harmonicVoltage, 0 ) + NVL( t0.harmonicCurrent, 0 ) + NVL( t0.threePhaseVoltageUnbalance, 0 ) + NVL( t0.flicker, 0 ) + NVL( t0.negative, 0 ) + NVL( t0.interharmonic, 0 ) + NVL( t1.SHORTINTERRUPTION, 0 ) + NVL( t1.VOLTAGEDIP, 0 ) + NVL( t1.VOLTAGESWELL, 0 )
) alarmTimes,
SUM( CASE WHEN NVL( t0.FREQUENCYDEVIATION, 0 ) > 0 THEN 1 ELSE 0 END ) count1,
SUM( NVL( t0.FREQUENCYDEVIATION, 0 ) ) times1,
SUM( CASE WHEN NVL( t0.voltageDeviation, 0 ) > 0 THEN 1 ELSE 0 END ) count2,
SUM( NVL( t0.voltageDeviation, 0 ) ) times2,
SUM( CASE WHEN NVL( t0.harmonicVoltage, 0 ) > 0 THEN 1 ELSE 0 END ) count3,
SUM( NVL( t0.harmonicVoltage, 0 ) ) times3,
SUM( CASE WHEN NVL( t0.harmonicCurrent, 0 ) > 0 THEN 1 ELSE 0 END ) count4,
SUM( NVL( t0.harmonicCurrent, 0 ) ) times4,
SUM( CASE WHEN NVL( t0.threePhaseVoltageUnbalance, 0 ) > 0 THEN 1 ELSE 0 END ) count5,
SUM( NVL( t0.threePhaseVoltageUnbalance, 0 ) ) times5,
SUM( CASE WHEN NVL( t0.flicker, 0 ) > 0 THEN 1 ELSE 0 END ) count6,
SUM( NVL( t0.flicker, 0 ) ) times6,
SUM( CASE WHEN NVL( t0.negative, 0 ) > 0 THEN 1 ELSE 0 END ) count7,
SUM( NVL( t0.negative, 0 ) ) times7,
SUM( CASE WHEN NVL( t0.interharmonic, 0 ) > 0 THEN 1 ELSE 0 END ) count8,
SUM( NVL( t0.interharmonic, 0 ) ) times8,
SUM( CASE WHEN NVL( t1.SHORTINTERRUPTION, 0 ) > 0 THEN 1 ELSE 0 END ) count9,
SUM( NVL( t1.SHORTINTERRUPTION, 0 ) ) times9,
SUM( CASE WHEN NVL( t1.VOLTAGEDIP, 0 ) > 0 THEN 1 ELSE 0 END ) count10,
SUM( NVL( t1.VOLTAGEDIP, 0 ) ) times10,
SUM( CASE WHEN NVL( t1.VOLTAGESWELL, 0 ) > 0 THEN 1 ELSE 0 END ) count11,
SUM( NVL( t1.VOLTAGESWELL, 0 ) ) times11
FROM
t0
FULL JOIN t1 ON t0.MYINDEX = t1.LINEID
LEFT JOIN PQ_LINE A ON t0.MYINDEX = A.LINE_INDEX
GROUP BY
A.SUB_INDEX
)
SELECT
C.NAME cityCompany,
A.NAME plantName,
B.DIC_NAME plantVoltageLevel,
t2.onlineMonitorCounts,
t2.alertMonitorCounts,
t2.ALARMTIMES alertCounts,
CASE WHEN t2.alertMonitorCounts = 0 THEN 0 ELSE ROUND(t2.ALARMTIMES/t2.alertMonitorCounts, 2) END alertAlarmFrequency,
CASE WHEN t2.count1 = 0 THEN 0 ELSE ROUND(t2.times1/t2.count1, 2) END frequencyDeviation,
CASE WHEN t2.count2 = 0 THEN 0 ELSE ROUND(t2.times2/t2.count2, 2) END voltageDeviation,
CASE WHEN t2.count3 = 0 THEN 0 ELSE ROUND(t2.times3/t2.count3, 2) END harmonicVoltage,
CASE WHEN t2.count4 = 0 THEN 0 ELSE ROUND(t2.times4/t2.count4, 2) END harmonicCurrent,
CASE WHEN t2.count5 = 0 THEN 0 ELSE ROUND(t2.times5/t2.count5, 2) END threePhaseVoltageUnbalance,
CASE WHEN t2.count6 = 0 THEN 0 ELSE ROUND(t2.times6/t2.count6, 2) END flicker,
CASE WHEN t2.count7 = 0 THEN 0 ELSE ROUND(t2.times7/t2.count7, 2) END negative,
CASE WHEN t2.count8 = 0 THEN 0 ELSE ROUND(t2.times8/t2.count8, 2) END interharmonic,
CASE WHEN t2.count9 = 0 THEN 0 ELSE ROUND(t2.times9/t2.count9, 2) END shortInterruption,
CASE WHEN t2.count10 = 0 THEN 0 ELSE ROUND(t2.times10/t2.count10, 2) END voltageDip,
CASE WHEN t2.count11 = 0 THEN 0 ELSE ROUND(t2.times11/t2.count11, 2) END voltageSwell
FROM
t2,
PQ_SUBSTATION A,
PQS_DICDATA B,
PQ_GDINFORMATION C
WHERE t2.SUB_INDEX = A.SUB_INDEX and A.SCALE = B.DIC_INDEX and A.GD_INDEX = C.GD_INDEX
<if test="level!=null and level!=''">
AND A.SCALE = #{level}
</if>
order by t2.ALARMTIMES desc
</select>
</mapper>

View File

@@ -0,0 +1,250 @@
<?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.user.DeptsLineMapper'>
<resultMap type="com.njcn.pojo.user.DeptsLine" id="DeptsLineMapperMap" autoMapping="true">
<id property="deptsIndex" column="DEPTS_INDEX"/>
</resultMap>
<select id="getBind" resultMap="DeptsLineMapperMap">
select * from pqs_deptsLine where depts_index = #{deptsIndex}
</select>
<update id="changeBindLine">
update PQS_DEPTSLINE set depts_index = #{deptsIndex} where line_index = #{index} and systype=#{sysType}
</update>
<select id="selectIndexsByDept" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
AND t1.DEPTS_INDEX = #{deptsIndex}
<if test="sysType != null">
AND t1.systype=#{sysType}
</if>
AND t3.DEVMODEL = #{devModel}
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDepts" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
AND t1.DEPTS_INDEX in
<foreach collection="depts" item="item" open="(" separator="," close=")">
#{item.deptsIndex}
</foreach>
AND t1.systype=#{sysType}
AND t3.DEVMODEL = #{devModel}
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDeptsRun" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
AND t1.DEPTS_INDEX in
<foreach collection="depts" item="item" open="(" separator="," close=")">
#{item.deptsIndex}
</foreach>
AND t1.systype=#{sysType}
AND t3.DEVMODEL = #{devModel}
<if test="devStatus!=null">
AND t3.DevFlag=#{devStatus}
</if>
<if test="status!=null">
AND t3.status = #{status}
</if>
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDeptRun" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
AND t1.DEPTS_INDEX = #{deptsIndex}
<if test="sysType != null">
AND t1.systype=#{sysType}
</if>
AND t3.DEVMODEL = #{devModel}
<if test="devStatus!=null">
AND t3.DevFlag=#{devStatus}
</if>
<if test="status!=null">
AND t3.status = #{status}
</if>
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDeptsRunForStatFlag" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3,
PQ_LINEDETAIL t4
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
AND t2.LINE_INDEX = t4.LINE_INDEX
AND t1.DEPTS_INDEX in
<foreach collection="depts" item="item" open="(" separator="," close=")">
#{item.deptsIndex}
</foreach>
AND t1.systype=#{sysType}
AND t3.DEVMODEL = #{devModel}
AND t3.DevFlag=#{devStatus}
<if test="status!=null">
AND t3.status = #{status}
</if>
AND t4.statflag = 1
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDeptRunForStatFlag" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3,
PQ_LINEDETAIL t4
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
AND t2.LINE_INDEX = t4.LINE_INDEX
AND t1.DEPTS_INDEX = #{deptsIndex}
<if test="sysType != null">
AND t1.systype=#{sysType}
</if>
AND t3.DEVMODEL = #{devModel}
AND t3.DevFlag=#{devStatus}
<if test="status!=null">
AND t3.status = #{status}
</if>
AND t4.statflag = 1
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDeptPlate" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3,
pq_deviceDetail t4
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
and t4.DEV_INDEX = t3.DEV_INDEX
and t4.electroplate = 1
AND t1.DEPTS_INDEX = #{deptsIndex}
<if test="sysType != null">
AND t1.systype=#{sysType}
</if>
AND t3.DEVMODEL = #{devModel}
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectIndexsByDeptsPlate" resultType="IndexsCount">
SELECT
t2.LINE_INDEX lineIndex,
t2.SUB_INDEX subIndex,
t2.DEV_INDEX devIndex,
t2.GD_INDEX gdIndex
FROM
PQS_DEPTSLINE t1,
PQ_LINE t2,
PQ_DEVICE t3,
pq_deviceDetail t4
WHERE
t1.LINE_INDEX = t2.LINE_INDEX
AND t2.DEV_INDEX = t3.DEV_INDEX
and t4.DEV_INDEX = t3.DEV_INDEX
and t4.electroplate = 1
AND t1.DEPTS_INDEX in
<foreach collection="depts" item="item" open="(" separator="," close=")">
#{item.deptsIndex}
</foreach>
AND t1.systype=#{sysType}
AND t3.DEVMODEL = #{devModel}
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,547 @@
<?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.user.DeptsLineTreeMapper'>
<resultMap type="DeptslineTree" id="proResultMap" autoMapping="true">
<id column="province_index" property="nodeIndex"/>
</resultMap>
<resultMap type="DeptslineTree" id="proJResultMap" autoMapping="true">
<id column="project_index" property="nodeIndex"/>
</resultMap>
<resultMap type="DeptslineTree" id="proVResultMap" autoMapping="true">
<id column="province_index" property="nodeIndex"/>
<id column="project_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="offgdResultMap" autoMapping="true">
<id column="gd_index" property="nodeIndex"/>
<result column="province_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="offsubResultMap" autoMapping="true">
<id column="Sub_index" property="nodeIndex"/>
<result column="gd_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="offlineResultMap" autoMapping="true">
<id column="line_index" property="nodeIndex"/>
<result column="sub_index" property="pId"/>
</resultMap>
<select id='getGdInfo' resultMap='offgdResultMap'>
select
gd_index,name
from pq_gdinformation
where
gd_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<resultMap type="DeptslineTree" id="gdByProMap" autoMapping="true">
<id column="Gd_index" property="nodeIndex"/>
<result column="province_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="subResultMap" autoMapping="true">
<id column="Sub_index" property="nodeIndex"/>
<result column="gd_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="transResultMap" autoMapping="true">
<id column="TFLGASS_INDEX" property="nodeTf"/>
<result column="Sub_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="devResultMap" autoMapping="true">
<id column="Dev_index" property="nodeIndex"/>
<result column="sub_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="devicetMap" autoMapping="true">
<id column="Dev_index" property="nodeIndex"/>
<result column="sub_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="subvResultMap" autoMapping="true">
<id column="subv_index" property="nodeIndex"/>
<result column="Dev_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="subvMap" autoMapping="true">
<id column="subv_index" property="nodeIndex"/>
<result column="Dev_index" property="pId"/>
</resultMap>
<resultMap type="DeptslineTree" id="lineResultMap" autoMapping="true">
<id column="line_index" property="nodeIndex"/>
<result column="subv_index" property="pId"/>
</resultMap>
<!--未绑定的(自定义)-->
<select id='getTreeGdInfo' resultMap='gdByProMap'>
select
gd_index,name,province_index
from pq_gdinformation
where
gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<select id='getOffTreeProVInfo' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<select id='getOffTreeSubInfo' resultMap='offsubResultMap'>
select b.province_index, a.name, a.sub_index,c.gd_index
from pq_substation a, pq_province b, pq_gdinformation c
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and a.sub_index in
(select sub_index
from pq_line
where dev_index in (select dev_index
from pq_device
where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and c.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by sub_index">
#{item}
</foreach>
</select>
<select id='getOffTreeLineInfo' resultMap='offlineResultMap'>
select
a.sub_index, a.name,a.line_index,b.devflag as state,b.status
from pq_line a,pq_device b,pq_substation c
where
a.sub_index = c.sub_index
and a.dev_index = b.dev_index
and b.datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
and a.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and a.line_index not in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex} and
systype=#{sysType})
order by a.line_index
</select>
<!--自己本身绑定的(自定义、非自定义)-->
<select id='getTreeGdInfomyself' resultMap='gdByProMap'>
select
gd_index,name,province_index
from pq_gdinformation
where
gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<!--省级-->
<select id='getOffTreeProVInfomyself' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<!--其他-->
<select id='getOffTreeProVInfosmyself' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where pq.name = #{area} and gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<select id='getOffTreeSubInfomyself' resultMap='offsubResultMap'>
select b.province_index, a.name, a.sub_index,c.gd_index
from pq_substation a, pq_province b, pq_gdinformation c
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and a.sub_index in
(select sub_index
from pq_line
where dev_index in (select dev_index
from pq_device
where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex}and
systype=#{sysType})
)
and c.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by sub_index">
#{item}
</foreach>
</select>
<select id='getOffTreeLineInfomyself' resultMap='offlineResultMap'>
select
a.sub_index, a.name,a.line_index,b.devflag as state,b.status
from pq_line a,pq_device b,pq_substation c
where
a.sub_index = c.sub_index
and a.dev_index = b.dev_index
and b.datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
and a.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and a.line_index in(select line_index from pqs_deptsLine where depts_index=#{deptsIndex} and
systype=#{sysType})
order by a.line_index
</select>
<!--非自定义未绑定的-->
<select id='getTreeGdInfono' resultMap='gdByProMap'>
select
gd_index,name,province_index
from pq_gdinformation
where
gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where SYSTYPE = #{sysType} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1))
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<select id='getOffTreeProVInfono' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where SYSTYPE = #{sysType} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1))
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<select id='getOffTreeProVInfonoarea' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where pq.name = #{area} and gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where SYSTYPE = #{sysType} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1))
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<select id='getOffTreeSubInfono' resultMap='offsubResultMap'>
select b.province_index, a.name, a.sub_index,c.gd_index
from pq_substation a, pq_province b, pq_gdinformation c
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and a.sub_index in
(select sub_index
from pq_line
where dev_index in (select dev_index
from pq_device
where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index not in(select line_index from pqs_deptsLine where SYSTYPE = #{sysType} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1))
)
and c.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by sub_index">
#{item}
</foreach>
</select>
<select id='getOffTreeLineInfono' resultMap='offlineResultMap'>
select
a.sub_index, a.name,a.line_index,b.devflag as state,b.status
from pq_line a,pq_device b,pq_substation c
where
a.sub_index = c.sub_index
and a.dev_index = b.dev_index
and b.datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
and a.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and a.line_index not in(select line_index from pqs_deptsLine where SYSTYPE = #{sysType} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1))
order by a.line_index
</select>
<!--非自定义其他已绑定的-->
<select id='getTreeGdInfoother' resultMap='gdByProMap'>
select
gd_index,name,province_index
from pq_gdinformation
where
gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where DEPTS_INDEX !=#{deptsIndex} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1) and SYSTYPE =#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by gd_index">
#{item}
</foreach>
</select>
<select id='getOffTreeProVInfoother' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where DEPTS_INDEX !=#{deptsIndex} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1) and SYSTYPE =#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<select id='getOffTreeProVInfootherarea' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where pq.name = #{area} and gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where DEPTS_INDEX !=#{deptsIndex} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1) and SYSTYPE =#{sysType})
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
<select id='getOffTreeSubInfoother' resultMap='offsubResultMap'>
select b.province_index, a.name, a.sub_index,c.gd_index
from pq_substation a, pq_province b, pq_gdinformation c
where a.gd_index = c.gd_index
and c.province_index = b.province_index
and a.sub_index in
(select sub_index
from pq_line
where dev_index in (select dev_index
from pq_device
where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
and line_index in(select line_index from pqs_deptsLine where DEPTS_INDEX !=#{deptsIndex} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1) and SYSTYPE =#{sysType})
)
and c.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=") order by sub_index">
#{item}
</foreach>
</select>
<select id='getOffTreeLineInfoother' resultMap='offlineResultMap'>
select
a.sub_index, a.name,a.line_index,b.devflag as state,b.status
from pq_line a,pq_device b,pq_substation c
where
a.sub_index = c.sub_index
and a.dev_index = b.dev_index
and b.datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
and a.gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and a.line_index in(select line_index from pqs_deptsLine where DEPTS_INDEX !=#{deptsIndex} and DEPTS_INDEX not in(select DEPTS_INDEX from pqs_depts where CUSTOM_DEPT = 1) and SYSTYPE =#{sysType})
order by a.line_index
</select>
<select id='getOffTreeProVInfos' resultMap='proVResultMap'>
select
pq.province_index province_index,dic.DIC_NAME name,pq.project_index project_index
from pq_province pq,PQS_DICDATA dic
where
pq.province_index in
(select province_index from pq_gdinformation where pq.name = #{area} and gd_index in
(select gd_index
from pq_line
where dev_index in
(select dev_index from pq_device where datatype in
<foreach collection="dataType" item="index" open="(" separator="," close=")">
#{index}
</foreach>
)
)
and gd_index in
<foreach collection="gdindex" item="item" open="(" separator="," close="))">
#{item}
</foreach>
and dic.DIC_INDEX = pq.name
order by province_index
</select>
</mapper>

View File

@@ -0,0 +1,259 @@
<?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.user.DeptsMapper">
<!-- 部门 -->
<resultMap type="com.njcn.pojo.user.Depts" id="DeptsMapperMap" autoMapping="true">
</resultMap>
<!-- 修改 -->
<update id="updateDepts">
update pqs_depts
set DEPTSNAME=#{deptsName},
PARENTNODE=#{parentNode},UPDATETIME=#{updateTime},
DEPTS_DESCRIPTION=#{deptsDescription},AREA=#{area} where DEPTS_INDEX=#{deptsIndex}
</update>
<!-- 根据父节点查询名称 -->
<select id="selectName" resultMap="DeptsMapperMap">
select * from pqs_depts
where node in
(
select parentnode from pqs_depts
where parentnode=#{parentNode}
)
and systype=#{sysType}
and state=1
</select>
<!-- 查询 -->
<select id="selectDeptAll" resultMap="DeptsMapperMap">
select*from pqs_depts where SYSTYPE=#{sysType} and state=1 order by node
</select>
<select id="queryDeptsByLikeAreaName" resultType="Depts">
select * from PQS_DEPTS where AREA like #{area} AND SYSTYPE=#{sysType} and state=1
</select>
<!-- 除去本身的名称 -->
<select id="selparentnode" resultMap="DeptsMapperMap">
select * from PQS_DEPTS where parentnode in (select parentnode from PQS_DEPTS where DEPTS_INDEX=#{deptsIndex} and state=1) and systype=#{sysType}
</select>
<!-- 查询除此之外的名称 -->
<select id="selName" resultMap="DeptsMapperMap">
select * from PQS_DEPTS where node not in (select parentnode from PQS_DEPTS where DEPTS_INDEX=#{deptsIndex} and state=1) and systype=#{sysType}
</select>
<select id="getId" resultMap="DeptsMapperMap">
select * from pqs_depts where node=#{node} and systype=#{sysType} and state=1
</select>
<select id="getAreaName" resultType="String">
select
t2.DIC_NAME
from PQS_DEPTS t1,PQS_DICDATA t2
where
t1.AREA=t2.DIC_INDEX
and
t1.SYSTYPE=#{sysType}
and
t1.state=1
order by T1.NODE asc
</select>
<select id="selectDeptsByDeptsIndex" resultType="Depts">
SELECT
t2.DIC_NAME area,
t2.DIC_NAME areaName,
t1.*
FROM
PQS_DEPTS t1,
PQS_DICDATA t2
WHERE
t1.AREA=t2.DIC_INDEX
AND
t1.DEPTS_INDEX=#{deptsIndex}
AND
t1.STATE=1
</select>
<select id="getDirectDeptsByNode" resultType="Depts">
SELECT
t1.DEPTS_INDEX,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME area,
t1.CUSTOM_DEPT
FROM
PQS_DEPTS t1
LEFT JOIN PQS_DICDATA t2 ON t1.area = t2.dic_index
WHERE
t1.PARENTNODEID = #{node}
AND t1.STATE =1
AND
t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2
ORDER BY t1.DEPTS_DESC ASC
</select>
<select id="getNoDirectDeptsByNode" resultType="Depts">
SELECT
t1.DEPTS_INDEX,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME area,
t1.CUSTOM_DEPT
FROM
PQS_DEPTS t1
LEFT JOIN PQS_DICDATA t2 ON t1.area = t2.dic_index
WHERE
t1.PARENTNODEID = #{node}
AND t1.STATE =1
AND
t1.CUSTOM_DEPT = 0
ORDER BY t1.DEPTS_DESC ASC
</select>
<select id="getDeptsByNode" resultType="Depts" databaseId="Oracle">
SELECT
t1.DEPTS_INDEX,
t1.PARENTNODEID,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME area,
t1.CUSTOM_DEPT
FROM
PQS_DEPTS t1,
PQS_DICDATA t2
WHERE
t1.area = t2.dic_index
AND t1.STATE = 1
AND
t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2
START WITH t1.PARENTNODEID = #{node} CONNECT BY PRIOR t1.DEPTS_INDEX = t1.PARENTNODEID
ORDER BY
t1.PARENTNODEID,
t1.DEPTS_DESC ASC
</select>
<select id="getDeptsByNode" resultType="Depts" databaseId="MariaDB">
WITH recursive t3 AS (
SELECT
a.DEPTS_INDEX,
a.PARENTNODEID,
a.DEPTSNAME,
a.DEPTS_DESC,
a.DIC_NAME,
a.CUSTOM_DEPT
FROM
(
SELECT
t1.DEPTS_INDEX,
t1.PARENTNODEID,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME,
t1.CUSTOM_DEPT
FROM
PQS_DEPTS t1,
PQS_DICDATA t2
WHERE
t1.STATE = 1
AND
t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2
AND t1.area = t2.dic_index
AND t1.PARENTNODEID = #{node}
) a UNION ALL
SELECT
b.DEPTS_INDEX,
b.PARENTNODEID,
b.DEPTSNAME,
b.DEPTS_DESC,
b.DIC_NAME,
b.CUSTOM_DEPT
FROM
(
SELECT
t1.DEPTS_INDEX,
t1.PARENTNODEID,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME,
t1.CUSTOM_DEPT
FROM
PQS_DEPTS t1,
PQS_DICDATA t2
WHERE
t1.STATE = 1
AND
t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2
AND t1.area = t2.dic_index
) b,
t3
WHERE
t3.DEPTS_INDEX = b.PARENTNODEID
) SELECT
*
FROM
t3 order by t3.depts_index
</select>
<select id="getDeptsByNodeUp" resultType="Depts" databaseId="Oracle">
SELECT DISTINCT
t1.DEPTS_INDEX,
t1.PARENTNODEID,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME area,
t1.CUSTOM_DEPT
FROM
PQS_DEPTS t1,
PQS_DICDATA t2
WHERE
t1.STATE = 1
AND
t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2
AND t1.area = t2.dic_index START WITH t1.DEPTS_INDEX = = #{deptsIndex} CONNECT BY PRIOR t1.PARENTNODEID = t1.DEPTS_INDEX
ORDER BY
t1.PARENTNODEID,
t1.DEPTS_DESC ASC
</select>
<select id="getDeptsByNodeUp" resultType="Depts" databaseId="MariaDB">
with recursive t3 as
(
select
a.DEPTS_INDEX,
a.PARENTNODEID,
a.DEPTSNAME,
a.DEPTS_DESC,
a.DIC_NAME,
a.CUSTOM_DEPT from
(SELECT
t1.DEPTS_INDEX,
t1.PARENTNODEID,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME,
t1.CUSTOM_DEPT
FROM PQS_DEPTS t1,PQS_DICDATA t2
where t1.STATE = 1 AND t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2 and t1.area = t2.dic_index and t1.DEPTS_INDEX = #{deptsIndex}) a
union all
select
b.DEPTS_INDEX,
b.PARENTNODEID,
b.DEPTSNAME,
b.DEPTS_DESC,
b.DIC_NAME,
b.CUSTOM_DEPT from
(SELECT
t1.DEPTS_INDEX,
t1.PARENTNODEID,
t1.DEPTSNAME,
t1.DEPTS_DESC,
t2.DIC_NAME,
t1.CUSTOM_DEPT
FROM PQS_DEPTS t1,PQS_DICDATA t2
where t1.STATE = 1 AND t1.CUSTOM_DEPT <![CDATA[ <> ]]> 2 and t1.area = t2.dic_index ) b,t3 where b.DEPTS_INDEX = t3.PARENTNODEID
)select * from t3
</select>
</mapper>

View File

@@ -0,0 +1,26 @@
<?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.user.ManageListMapper">
<resultMap type="com.njcn.pojo.user.ManageList" id="ManageListMap" autoMapping="true">
<id property="res_Index" column="RES_INDEX"/>
</resultMap>
<!-- 根据guid查询 -->
<select id="selectOneByIndex" resultMap="ManageListMap">
SELECT RES_INDEX,NAME,DESCRIPTION,RES_URL,UPDATEUSER,UPDATETIME,STATE,SYSTYPE FROM PQS_ResInformation WHERE RES_INDEX =#{res_Index} and state=1
</select>
<update id="deleteIndex">
update PQS_ResInformation set state=0 where RES_INDEX =#{res_Index}
</update>
<select id="getBasemang" resultMap="ManageListMap">
select * from PQS_RESINFORMATION where STATE=1 and type ='93290044-2c03-4587-8319-4f604af7a80f' and
SYSTYPE=#{sysType}
</select>
<select id="getReport" resultMap="ManageListMap">
select * from PQS_RESINFORMATION where STATE=1 and type ='6da9882c-aba0-439e-8e04-dc6695bfc49c' and
SYSTYPE=#{sysType}
</select>
<select id="getSub" resultMap="ManageListMap">
select * from PQS_RESINFORMATION where STATE=1 and type ='3c81323b-9de6-43a1-b90a-d395aa76ed61' and
SYSTYPE=#{sysType}
</select>
</mapper>

View File

@@ -0,0 +1,66 @@
<?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.user.RoleMapper">
<!-- 角色组 -->
<!-- 用户 -->
<!-- 角色 -->
<resultMap type="com.njcn.pojo.user.Role" id="RoleMapperMap" autoMapping="true">
<id property="roleIndex" column="ROLE_INDEX"/>
<association property="uID" autoMapping="true" javaType="User">
<id property="userIndex" column="USER_INDEX"/>
</association>
</resultMap>
<!-- 增加 -->
<insert id="insertRole">
insert into pqs_role (role_index,RoleName,user_index,updatetime,ROLE_DESCRIPTION,state) values(#{roleIndex},#{roleName},#{userIndex},#{updateTime},#{roleDescription},#{state})
</insert>
<!-- 删除 -->
<update id="deleteRole">
update PQS_Role set state=0 where role_Index=#{roleIndex,jdbcType=VARCHAR}
</update>
<!-- 修改 -->
<update id="updateRole">
update pqs_role set RoleName=#{roleName},user_index=#{userIndex},updatetime=#{updateTime},ROLE_DESCRIPTION=#{roleDescription},state=#{state} where role_Index=#{roleIndex,jdbcType=VARCHAR}
</update>
<!-- 根据id查询id -->
<select id="selectRoleIndex" resultMap="RoleMapperMap">
select *from pqs_role where role_Index=#{roleIndex,jdbcType=VARCHAR}
</select>
<!-- 根据id查询用户名 -->
<select id="selectUserId" resultMap="RoleMapperMap">
select *from pqs_role where user_index=#{userId}
</select>
<!-- 查询角色名 -->
<select id="selName" resultType="java.lang.Integer">
select COUNT(*) from pqs_role where rolename=#{roleName}
</select>
<!-- 根据角色名查询所有 -->
<select id="queryNameAll" resultMap="RoleMapperMap">
select *from pqs_role r join pqs_user u on r.user_Index=u.user_Index where rolename like #{roleName} ORDER BY updatetime desc
</select>
<!-- 查询 -->
<select id="selectAll" resultMap="RoleMapperMap">
select *from PQS_Role r join pqs_user u on r.user_Index=u.user_Index ORDER BY updatetime desc
</select>
<select id="getRoles" resultType="String">
SELECT
T2.ROLENAME
FROM
PQS_ROLEGPASS t1
LEFT JOIN PQS_ROLE t2 ON T1.ROLE_INDEX = T2.ROLE_INDEX
WHERE
T1.ROLEGP_INDEX = #{roleGPIndex}
</select>
<select id="selectAlls" resultMap="RoleMapperMap">
select *from PQS_ROLE where rolename not in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and state = 1
</select>
</mapper>

View File

@@ -0,0 +1,16 @@
<?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.user.SecretKeyMapper">
<resultMap type="com.njcn.pojo.user.SecretKey" id="SecretKeyMapperMap" autoMapping="true">
<id property="secretKeyIndex" column="SECRETKEY_INDEX"/>
<association property="uID" autoMapping="true" javaType="User">
<id property="userIndex" column="USER_INDEX"/>
</association>
</resultMap>
<select id="selectSecretkey" resultMap="SecretKeyMapperMap">
select *from PQS_SECRETKEY where USER_INDEX=#{userIndex,jdbcType=VARCHAR}
</select>
</mapper>

View File

@@ -0,0 +1,106 @@
<?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.user.UserMapper">
<!-- 用户 -->
<resultMap type="com.njcn.sso.pojo.user.User" id="UserMapperMap" autoMapping="true">
<id property="userIndex" column="USER_INDEX"/>
</resultMap>
<!-- 修改密码 -->
<update id="updatePassword">
update PQS_User
set password=#{password} where USER_INDEX=#{userIndex}
</update>
<!-- 修改 -->
<update id="updateUsers">
update PQS_User
set NAME=#{name},LOGINNAME=#{loginName},
phone=#{phone},email=#{email},mark=#{mark},LOGINTIME=#{loginTime} where USER_INDEX=#{userIndex,jdbcType=VARCHAR}
</update>
<!-- 删除用户 -->
<update id="deleteUserByIndex">
update pqs_user
set state=#{state} where USER_INDEX=#{userIndex,jdbcType=VARCHAR}
</update>
<!-- 根据id查询id -->
<select id="selectId" resultMap="UserMapperMap">
select *from PQS_User u where u.USER_INDEX=#{userIndex}
</select>
<!-- 根据登录名查询 -->
<select id="selectloginName" resultType="java.lang.Integer">
select COUNT(*) from pqs_user where LOGINNAME=#{loginName}
</select>
<!-- 审核新增用户 -->
<update id="updateExaminer">
update pqs_user u set u.state=#{state} where u.USER_INDEX=#{userIndex}
</update>
<!-- 查询除此之外的名称 -->
<select id="selectName" resultMap="UserMapperMap">
select * from pqs_user where name not in (select name from pqs_user where user_index=#{userIndex}) and state = 1
</select>
<!-- 查询 -->
<select id="selectAllUser" resultMap="UserMapperMap">
select *from PQS_User u WHERE STATE in(1,3) order by u.LOGINTIME desc
</select>
<select id="selectIdName" resultType="java.lang.String">
select LOGINNAME from pqs_user where user_index=#{userIndex}
</select>
<update id="updateByPrimaryKeyBySql" parameterType="user">
update pqs_user
<set>
<if test="userIndex != null">user_Index=#{userIndex},</if>
<if test="name != null">name=#{name},</if>
<if test="loginName != null">loginName=#{loginName},</if>
<if test="password != null">password=#{password},</if>
<if test="phone != null">phone=#{phone},</if>
<if test="email != null">email=#{email},</if>
<if test="registerTime != null">registerTime=#{registerTime},</if>
<if test="psdvalidity != null">psdvalidity=#{psdvalidity},</if>
<if test="loginTime != null">loginTime=#{loginTime},</if>
<if test="state != null">state=#{state},</if>
<if test="mark != null">mark=#{mark},</if>
<if test="limitIpStart != null">limit_IpStart=#{limitIpStart},</if>
<if test="limitIpEnd != null">limit_IpEnd=#{limitIpEnd},</if>
<if test="limitTime != null">limit_Time=#{limitTime},</if>
<if test="loginErrorTimes != null">LOGIN_ERROR_TIMES=#{loginErrorTimes},</if>
<if test="casualUser != null">casual_User=#{casualUser},</if>
<if test="firstErrorTime != null">firstError_Time=#{firstErrorTime},</if>
<if test="lockTime != null">lock_Time=#{lockTime}</if>
</set>
where user_Index=#{userIndex}
</update>
<select id="getMailUsers" resultMap="UserMapperMap">
select *
from pqs_user a
where a.user_index in
(select b.user_index from pqs_userset b where b.isnotice = 0)
</select>
<select id="getUserAll" resultType="com.njcn.pojo.user.UserDetail">
SELECT
t.userIndex userIndex,
t.userName userName,
t.loginName loginName,
t.deptsName deptsName,
listagg ( t.roleName, ',' ) within GROUP ( ORDER BY t.userIndex ) AS roleName
FROM
(
SELECT DISTINCT
users.USER_INDEX userIndex,
users.NAME userName,
users.LOGINNAME loginName,
depts.DEPTSNAME deptsName,
role.ROLE_DESCRIPTION roleName
FROM
( SELECT * FROM pqs_user WHERE USER_INDEX = #{userIndex} ) users
LEFT JOIN PQS_USERSET userset ON userset.USER_INDEX = users.USER_INDEX
LEFT JOIN PQS_DEPTS depts ON depts.DEPTS_INDEX = userset.DEPTS_INDEX
LEFT JOIN PQS_ROLEGPASS roleass ON roleass.ROLEGP_INDEX = userset.ROLEGP_INDEX
LEFT JOIN pqs_role role ON role.ROLE_INDEX = roleass.ROLE_INDEX
) t
GROUP BY
t.userIndex,t.userName,t.loginName,t.deptsName
</select>
</mapper>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 开启驼峰自动映射 -->
<setting name="mapUnderscoreToCamelCase" value="true" />
<!--输出mybatis执行的SQL日志-->
<!-- <setting name="logImpl" value="STDOUT_LOGGING"/>-->
<!--懒加载配置-->
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="false"/>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
<!--使用mybatis的分页插件-->
<!-- <plugins> -->
<!-- <plugin interceptor="com.github.pagehelper.PageHelper"> -->
<!-- <property name="dialect" value="mysql"/> -->
<!-- 该参数默认为false -->
<!-- 设置为true时使用RowBounds分页会进行count查询 -->
<!-- <property name="rowBoundsWithCount" value="true"/> -->
<!-- </plugin> -->
<!-- </plugins> -->
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- 使用下面的方式配置参数,后面会有所有的参数介绍 -->
<property name="helperDialect" value="oracle"/>
<property name="reasonable" value="false"/>
<property name="offsetAsPageNum" value="true"/>
<property name="rowBoundsWithCount" value="false"/>
</plugin>
</plugins>
</configuration>

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
<!-- 定义Mybatis的SqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 定义数据源 -->
<property name="dataSource" ref="${dataSource}"/>
<property name="databaseIdProvider" ref="databaseIdProvider"/>
<!-- 指定mybatis全局配置文件 -->
<property name="configLocation" value="classpath:mybatis/mybatis-config.xml" />
<!-- 扫描mappers目录以及子目录下的所有xml文件 -->
<property name="mapperLocations" value="classpath:mybatis/mappers/**/*.xml" />
<!-- 别名扫描包 -->
<property name="typeAliasesPackage" value="com.njcn.pojo com.pqs9000.pojo com.njcn.sso.pojo" />
</bean>
<bean id="transactionManagerManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="${dataSource}"/>
</bean>
<!-- 定义Mapper接口扫描器 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.njcn.mapper com.pqs9000.mapper" />
</bean>
<!--配置通用mapper -->
<bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.njcn.mapper com.pqs9000.mapper" />
<property name="properties">
<value>
mappers=tk.mybatis.mapper.common.Mapper
<!-- 仅对insert有效 -->
ORDER=BEFORE
</value>
</property>
</bean>
</beans>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-lazy-init="true">
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxIdle" value="30"/><!-- 最大闲置 -->
<property name="minIdle" value="10"/><!-- 最小闲置 -->
<property name="testOnBorrow" value="true"/><!-- 可以获取 -->
<!--<property name="testOnReturn" value="true"/>-->
</bean>
<!-- redis 配置,也可以把配置挪到properties配置文件中,再读取 -->
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="0" ref="jedisPoolConfig" />
<!-- 端口默认6379 -->
<constructor-arg index="2" value="6379" name="port" type="int" />
<constructor-arg index="3" value="5000" name="timeout" type="int" />
<constructor-arg index="1" value="127.0.0.1" name="host" type="java.lang.String" />
<!--<constructor-arg index="1" value="192.168.1.100" name="host" type="java.lang.String" />-->
<!--<constructor-arg index="4" value="yourpassword" name="password" type="java.lang.String" />-->
</bean>
</beans>

View File

@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<description>== Shiro Components ==</description>
<!-- 会话Session ID生成器 -->
<bean id="sessionIdGenerator" class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator"/>
<!-- 会话Cookie模板 -->
<bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
<constructor-arg value="pqs9000"/>
<property name="httpOnly" value="true"/>
<!--cookie的有效时间 -->
<property name="maxAge" value="-1"/>
<property name="name" value="9000Cookie" />
</bean>
<!-- user shiro session listener -->
<bean id="userSessionListener" class="com.njcn.shiro.listener.UserSessionListener">
<property name="userShiroSessionRepository" ref="jedisShiroSessionRepository"/>
</bean>
<!-- user shiro session dao -->
<bean id="userShiroSessionDAO" class="com.njcn.shiro.session.UserShiroSessionDao">
<property name="userShiroSessionRepository" ref="jedisShiroSessionRepository"/>
<property name="sessionIdGenerator" ref="sessionIdGenerator"/>
</bean>
<!-- 手动操作Session管理Session -->
<bean id="userSessionManager" class="com.njcn.shiro.session.UserSessionManager">
<property name="userShiroSessionRepository" ref="jedisShiroSessionRepository"/>
</bean>
<!-- Session Manager -->
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<!-- 相隔多久检查一次session的有效性 -->
<property name="sessionValidationInterval" value="1800000"/>
<!-- session 有效时间为半小时 (毫秒单位)-->
<property name="globalSessionTimeout" value="1800000"/>
<property name="sessionDAO" ref="userShiroSessionDAO"/>
<!-- session 监听,可以多个。 -->
<property name="sessionListeners">
<list>
<ref bean="userSessionListener"/>
</list>
</property>
<!-- 间隔多少时间检查不配置是60分钟 -->
<property name="sessionValidationScheduler" ref="sessionValidationScheduler"/>
<!-- 会话Cookie模板 -->
<property name="sessionIdCookie" ref="sessionIdCookie"/>
</bean>
<!-- 会话验证调度器 -->
<bean id="sessionValidationScheduler" class="org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler">
<property name="sessionManager" ref="sessionManager"/>
</bean>
<!-- shiro 缓存实现对ShiroCacheManager采用redis的实现 -->
<bean id="jedisShiroCacheManager" class="com.njcn.shiro.cache.impl.JedisShiroCacheManager">
<property name="jedisManager" ref="jedisManager"/>
</bean>
<!-- 用户缓存 -->
<bean id="userShiroCacheManager" class="com.njcn.shiro.cache.impl.UserShiroCacheManager">
<property name="shiroCacheManager" ref="jedisShiroCacheManager"/>
</bean>
<!-- 安全管理器 -->
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="dataRealm"/>
<property name="sessionManager" ref="sessionManager"/>
<property name="cacheManager" ref="userShiroCacheManager"/>
</bean>
<bean id="jedisManager" class="com.njcn.utils.redis.JedisManager" />
<!-- session 创建、删除、查询 -->
<bean id="jedisShiroSessionRepository" class="com.njcn.shiro.session.impl.JedisShiroSessionRepository" >
<property name="jedisManager" ref="jedisManager"/>
</bean>
<!-- 静态注入相当于调用SecurityUtils.setSecurityManager(securityManager) -->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="org.apache.shiro.SecurityUtils.setSecurityManager"/>
<property name="arguments" ref="securityManager"/>
</bean>
<!-- 静态注入 jedisShiroSessionRepository-->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="com.njcn.shiro.filter.KickoutSessionFilter.setUserShiroSessionRepository"/>
<property name="arguments" ref="jedisShiroSessionRepository"/>
</bean>
<!-- 静态注入 jedisShiroSessionRepository-->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="com.njcn.shiro.filter.LoginFilter.setUserShiroSessionRepository"/>
<property name="arguments" ref="jedisShiroSessionRepository"/>
</bean>
<bean id="dataRealm" class="com.njcn.shiro.realm.DataRealm" />
<!--
自定义角色过滤器 支持多个角色可以访问同一个资源 eg:/home.jsp = authc,roleOR[admin,user]
用户有admin或者user角色 就可以访问
-->
<!-- 认证数据库存储-->
<bean id="login" class="com.njcn.shiro.filter.LoginFilter"/>
<bean id="role" class="com.njcn.shiro.filter.RoleFilter"/>
<bean id="permission" class="com.njcn.shiro.filter.PermissionFilter"/>
<bean id="simple" class="com.njcn.shiro.filter.SimpleAuthFilter"/>
<!-- session 校验单个用户是否多次登录 -->
<bean id="kickoutSessionFilter" class="com.njcn.shiro.filter.KickoutSessionFilter" />
<!-- shiro filter配置 -->
<bean id="shiroSecurityFilter" class="com.njcn.shiro.response.NjcnShiroFilterFactoryBean">
<!-- shiro 的核心安全接口 -->
<property name="securityManager" ref="securityManager" />
<!-- 要求登录时的链接 -->
<property name="loginUrl" value="/" />
<!-- 登陆成功后要跳转的连接 -->
<property name="successUrl" value="/main" />
<!-- 未授权时要跳转的连接 -->
<property name="unauthorizedUrl" value="/views/auth/unauthorized" />
<!-- shiro 连接约束配置 -->
<!-- url级别权限权限控制 -->
<property name="filterChainDefinitions">
<value>
<!--不需要权限所有用户能直接获取的资源-->
/css/**=anon
/js/**=anon
/images/**=anon
/json/**=anon
/jspJS/**=anon
/jspCSS/**=anon
/tiles/**=anon
/theme/**=anon
/user/generateRSAKey=anon
/user/generateSM2Key=anon
/druid/**=anon
/druid=anon
/auth/**=anon
/njcn/**=anon
/user/ssoRegister=anon
/=login,kickout
/**=login,kickout,role[normal,wenchang]
</value>
</property>
<property name="filters">
<util:map>
<entry key="login" value-ref="login" />
<entry key="role" value-ref="role" />
<entry key="simple" value-ref="simple" />
<entry key="permission" value-ref="permission" />
<entry key="kickout" value-ref="kickoutSessionFilter" />
</util:map>
</property>
</bean>
<!-- 保证实现了Shiro内部lifecycle函数的bean执行 -->
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
depends-on="lifecycleBeanPostProcessor" >
<property name="proxyTargetClass" value="true" />
</bean>
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="securityManager" ref="securityManager" />
</bean>
</beans>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
<description>Spring公共配置</description>
<!-- 使用spring自带的占位符替换功能 -->
<bean id="encryptPropertyPlaceholderConfigurer" class="com.njcn.utils.EncryptPropertyPlaceholderConfigurer">
<!-- 允许JVM参数覆盖 -->
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<!-- 忽略没有找到的资源文件 -->
<property name="ignoreResourceNotFound" value="true"/>
<!-- 配置资源文件 -->
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:java.properties</value>
</list>
</property>
</bean>
<!--spring自带的定时任务方案解决需要配置的 -->
<task:annotation-driven/>
<!-- 数据源配置,使用应用内的DBCP数据库连接池 ****start**** -->
<bean id="MariaDB" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close" lazy-init="true">
<property name="driverClassName" value="${mariadb.driverClass}"/>
<property name="url" value="${mariadb.jdbcUrl}"/>
<property name="username" value="${mariadb.user}"/>
<property name="password" value="${mariadb.password}"/>
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${mariadb.initialSize}"/>
<property name="minIdle" value="${mariadb.minIdle}"/>
<property name="maxActive" value="${mariadb.maxActive}"/>
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="${mariadb.maxWait}"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="${mariadb.timeBetweenEvictionRunsMillis}"/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="${mariadb.minEvictableIdleTimeMillis}"/>
<property name="testWhileIdle" value="true"/>
<property name="validationQuery" value="SELECT 'x' from dual"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<property name="removeAbandoned" value="false"/>
<property name="removeAbandonedTimeout" value="300"/>
<property name="logAbandoned" value="false"/>
<!-- 打开PSCache并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="${mariadb.poolPreparedStatements}"/>
<property name="maxPoolPreparedStatementPerConnectionSize"
value="${mariadb.maxPoolPreparedStatementPerConnectionSize}"/>
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat"/>
</bean>
<bean id="Oracle" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"
lazy-init="true">
<property name="driverClassName" value="${oracle.driverClass}"/>
<property name="url" value="${oracle.jdbcUrl}"/>
<property name="username" value="${oracle.user}"/>
<property name="password" value="${oracle.password}"/>
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${oracle.initialSize}"/>
<property name="minIdle" value="${oracle.minIdle}"/>
<property name="maxActive" value="${oracle.maxActive}"/>
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="${oracle.maxWait}"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="${oracle.timeBetweenEvictionRunsMillis}"/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="${oracle.minEvictableIdleTimeMillis}"/>
<property name="testWhileIdle" value="true"/>
<property name="validationQuery" value="SELECT 'x' from dual"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<property name="removeAbandoned" value="false"/>
<property name="removeAbandonedTimeout" value="300"/>
<property name="logAbandoned" value="false"/>
<!-- 打开PSCache并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="${oracle.poolPreparedStatements}"/>
<property name="maxPoolPreparedStatementPerConnectionSize"
value="${oracle.maxPoolPreparedStatementPerConnectionSize}"/>
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat"/>
</bean>
<bean id="vendorProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="Oracle">Oracle</prop>
<prop key="MariaDB">MariaDB</prop>
</props>
</property>
</bean>
<bean id="databaseIdProvider" class="org.apache.ibatis.mapping.VendorDatabaseIdProvider">
<property name="properties" ref="vendorProperties"/>
</bean>
<bean class="com.njcn.utils.SpringContextUtil"/>
<bean id="log-filter" class="com.alibaba.druid.filter.logging.Log4jFilter">
<property name="resultSetLogEnabled" value="false"/>
<property name="statementExecutableSqlLogEnable" value="true"/>
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="utf-8"/>
<property name="maxUploadSize" value="1048576000"/>
<property name="maxInMemorySize" value="4096"/>
<property name="resolveLazily" value="true"/>
</bean>
<!-- 数据源配置,使用应用内的DBCP数据库连接池 ****end**** -->
<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
<context:component-scan base-package="com.njcn,com.pqs9000">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
</beans>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd"
default-lazy-init="true">
<!-- 注解驱动 -->
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/html;charset=UTF-8"/>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<context:component-scan base-package="com.pqs9000.controller"/>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.njcn.interceptor.CSRFInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<!--处理静态资源的拦截问题-->
<mvc:default-servlet-handler/>
<!-- 视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>