初始化项目

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,66 @@
################################通用且因环境变化而变化
#波形文路径(本地配置)
WAVE_PATH=C:/Comtrade
#服务器临时文件路径(用于存储离线、报告存储)
TMP_PATH=C:/
#webSocket
WEBSOCKET=ws://127.0.0.1:8080/pqs9300/websocket/
#socket端口配置
SOCKETPORT=60000
#Kafka
ZOOKEEPER=192.168.1.200:2181
GROUPID=test-consumer-group
TOPIC=realdata
KAFKA_LOG=false
#报表生成路径
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=1
#是否发送邮件
MAIL_FLAG=false
#邮件服务器连接地址
MAIL_HOST=111
#发送方邮箱
MAIL_ADDRESS=1@qq.com
#SMTP授权码
SMTP_NUM=111
#海南短信验证
MSG_USER=1C6CC426DFE8D7C2BC42C7C19F101D80
MSG_PASSWORD=8836E651F09195FA3EE892A1B700DC65
################################独立配置且不随环境变化
#当前系统标志
SYSTEM_FLAG=PQS9000
#当前系统的GUID
SYS_TYPE=2e5c5bda-f2c6-4b17-a73d-ee00f53401d5
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,58 @@
#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
#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,52 @@
<?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="e:/logs/pqs9300/info/info.log" />
<!--<param name="File" value="/usr/local/logs/pqs9900/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="e:/logs/pqs9300/error/error.log" />
<!--<param name="File" value="/usr/local/logs/pqs9900/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,108 @@
<?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>
</mapper>

View File

@@ -0,0 +1,217 @@
<?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>
<select id="setAreaNo" resultMap="DicDataMapperMap">
select t.* from PQS_DICDATA t where t.dic_index not in(select area from pqs_depts where DEPTS_INDEX
!=#{deptIndex} and state=1 ) and t.dic_type=(SELECT DICTYPE_INDEX from PQS_DICTYPE where DICTYPE_NAME = #{dicTypeName}) and t.STATE=1
</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>
<!-- 查询省份区域 -->
<select id="queryDicPro" 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.dic_leave = 9
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="selAllType" resultType="String">
select distinct t.back_up
from
(
select
a.*
from
pqs_dicdata a,pqs_dictype b
where
a.dic_type=b.dictype_index
and a.dic_type in
<foreach collection="typeId" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
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="selectAllExcelData" resultType="DicDataExcelBody">
select * from PQS_DICDATA where STATE =1
</select>
<select id="getMangType" resultMap="DicDataMapperMap">
select * from PQS_DICDATA where state=1 and dic_TYPE=(SELECT DICTYPE_INDEX from PQS_DICTYPE where DICTYPE_NAME = #{dicTypeName})
</select>
<select id="getDicDataIndex" resultType="String">
SELECT
T2.DIC_INDEX
FROM
PQS_DICDATA t2
WHERE
T2.DIC_TYPE = (
SELECT
T1.DICTYPE_INDEX
FROM
PQS_DICTYPE t1
WHERE
DICTYPE_NAME= #{type}
)
AND
T2.TRIPHASE= #{temp}
</select>
<!-- 更新字典表根据主键-->
<update id="updateByPrimaryKeyBySql">
UPDATE PQS_DICDATA
SET DIC_LEAVE = #{dicLeave}
WHERE
DIC_INDEX = #{dicIndex}
</update>
<select id="queryProIdByname" resultMap="DicDataMapperMap">
select *
from pqs_dicdata
where dic_name = #{dicName}
and dic_leave = 9
</select>
<select id="getDicName" resultType="String">
select dic_Name from pqs_dicdata where dic_index = #{dicIndex}
</select>
<select id="getTartgetTypeForDic" resultType="com.njcn.pojo.configuration.DicData">
select a.DIC_INDEX as dicIndex,
a.DIC_NAME as dicName,
a.DIC_TYPE as dicType
from PQS_DICDATA a
left join PQS_DICTYPE b on a.DIC_TYPE = b.DICTYPE_INDEX
where b.DICTYPE_NAME = #{type}
and a.STATE = 1
order by a.triphase asc
</select>
</mapper>

View File

@@ -0,0 +1,826 @@
<?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.LineMapper">
<select id="getDetailed" resultType="com.njcn.pojo.data.Detailed">
select b.name pointName,b.line_index lineId, c.name gdName, d.name bdName,e.tinterval tinterval,a.timeid dTime,
a.freq_dev_overtime freqDevOverTime,
a.voltage_dev_overtime voltageDevOvertime,
a.ubalance_overtime UBalanceOverTime,
a.flicker_overtime flickerOverTime,
a.uaberrance_overtime UAberranceOverTime,
<foreach collection="list" item="item" separator=",">
a.uharm_${item}_overtime UHarm${item}OverTime,
a.iharm_${item}_overtime IHarm${item}OverTime
</foreach>
from limit_rate a, pq_line b, pq_gdinformation c, pq_substation d,pq_linedetail e
where a.myindex = b.line_index
and a.myindex in
<foreach collection="listLine" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
and b.gd_index = c.gd_index
and b.sub_index = d.sub_index
and e.line_index = a.myindex
and a.phasic_type = 'T' and a.timeid between #{start} and #{end}
</select>
<select id="queryLineData" resultType="line">
SELECT
T .GD_INDEX,
T .SUB_INDEX,
T.DEV_INDEX,
T .NAME
FROM
PQ_LINE T
where t.line_index=#{lineid}
</select>
<select id="getLineIndex" resultType="int">
SELECT
T.LINE_INDEX
FROM
PQ_LINE T
WHERE
T.Dev_Index
IN
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<select id="getLineIndexs" resultType="int">
SELECT
T.LINE_INDEX
FROM
PQ_LINE T
WHERE
T.SCALE=#{dicIndex}
AND
T.DEV_INDEX
IN
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<select id="getDeviceIndexs" resultType="int">
SELECT
DEV_INDEX
FROM
PQ_LINE
WHERE
DEV_INDEX IN
<foreach collection="list" item="item" open="(" close=")"
separator=",">
#{item}
</foreach>
AND
SCALE=#{dicIndex}
GROUP BY
DEV_INDEX
</select>
<select id="getLineIndexsByLoadType" resultType="int">
SELECT
T.LINE_INDEX
FROM
PQ_LINE T
INNER JOIN
PQ_LINEDETAIL T1
ON T.LINE_INDEX=T1.LINE_INDEX
WHERE
T1.LoadType=#{dicIndex}
AND
T.DEV_INDEX
IN
<foreach collection="list" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
</select>
<select id="getDeviceIndexsByLoadType" resultType="int">
SELECT
DEV_INDEX
FROM
PQ_LINE T
INNER JOIN PQ_LINEDETAIL T1
ON
T.LINE_INDEX=T1.LINE_INDEX
WHERE
T.DEV_INDEX
IN
<foreach collection="list" item="item" open="(" close=")"
separator=",">
#{item}
</foreach>
AND
T1.LOADTYPE=#{dicIndex}
GROUP BY
T.DEV_INDEX
</select>
<select id="getGWLines" resultType="Integer">
SELECT
T2.LINE_INDEX
FROM
PQ_LINE t1,
PQ_LINEDETAIL t2,
PQ_DEVICE t3
WHERE
T1.LINE_INDEX = T2.LINE_INDEX
AND T1.DEV_INDEX=T3.DEV_INDEX
AND T3.DEVFLAG=0
AND
T1.LINE_INDEX
IN
<foreach collection="list" item="item" open="(" close=")"
separator=",">
#{item}
</foreach>
AND T2.MONITOR_ID IS NOT NULL
</select>
<select id="getLineByEventDetailIndex" resultType="line">
select
t1.*
from
PQ_LINE t1,PQS_EVENTDETAIL t2
where
t1.LINE_INDEX=t2.LINEID
and
t2.EVENTDETAIL_INDEX=#{eventIndex}
</select>
<select id="getNodeIpbylineIndex" resultType="String">
select
t1.Node_IP
from
NODEINFORMATION t1,PQ_LINE t2,PQ_DEVICE t3
where
t1.Node_Index=t3.NODE_INDEX
and T2.DEV_INDEX = t3.DEV_INDEX
and T2.LINE_INDEX =#{lineIndex}
</select>
<select id="getNodeIpbyDevIndex" resultType="String">
SELECT
t1.Node_IP
FROM
NODEINFORMATION t1,
PQ_DEVICE t3
WHERE
t1.Node_Index = t3.NODE_INDEX
and t3.DEV_INDEX =#{lineIndex}
</select>
<select id="getIntervalByIndex" resultType="int">
SELECT
tinterval
FROM
pq_lineDetail
WHERE
line_index = #{lineIndex}
</select>
<select id="queryByLineIndex" resultType="ResponsibilityData">
SELECT
T1.NAME lineName,
T1.LINE_INDEX lineIndex,
T2.NAME gdName,
T3.NAME subName,
T4.NAME devName,
T4.IP
FROM
PQ_LINE t1,
PQ_GDINFORMATION t2,
PQ_SUBSTATION t3,
PQ_DEVICE t4
WHERE
t1.gd_index = t2.gd_index
AND t1.sub_index = t3.sub_index
AND t1.dev_index = t4.dev_index
AND t1.line_index = #{lineIndex}
</select>
<select id="getLinesByPro" resultType="line">
select *
from pq_line
where gd_index in
(select gd_index from pq_gdinformation where province_index = #{proIndex})
</select>
<select id="getRole" resultType="java.lang.Integer">
select count(a.path)
from pqs_function a, pqs_rolefunction b, pqs_functionploy c
where a.path = #{url}
and a.function_index = b.function_index
and b.function_ploy = c.function_index
and c.state = 1
and b.role_index in
<foreach collection="role" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getLineName" resultType="com.njcn.pojo.commons.device.MachineAccount">
select a.name name, b.dic_name Scale, c.name subName,d.pttype pttype
from pq_line a, pqs_dicdata b, pq_substation c,pq_linedetail d
where a.line_index = #{lineId}
and a.scale = b.dic_index
and a.sub_index = c.sub_index
and a.line_index = d.line_index
</select>
<select id="getSubDeptsIndex" resultType="com.njcn.pojo.user.Depts">
select t.depts_index deptsIndex,
t.area area,
t.deptsname deptsName,
a.dic_name areaName,
t.custom_dept customDept
from pqs_depts t, pqs_dicdata a
where t.parentnodeid = #{parentDeptsIndex}
and t.area = a.dic_index
and t.state = 1
<if test="listArea !=null">
and t.depts_index in
<foreach collection="listArea" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</if>
</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.devflag = 0
and b.devmodel = 1
</select>
<select id="getDeptsLineIndex" resultType="java.lang.Integer"
databaseId="MariaDB">
SELECT DISTINCT
( a.line_index )
FROM
pqs_deptsline a,
pq_device b,
pq_line c
WHERE
a.depts_index IN (
WITH recursive t2 AS (
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1 where
t1.parentnodeid = #{deptsIndex} UNION ALL
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1,
t2
WHERE
t1.parentnodeid = #{deptsIndex}
and t1.depts_index = t2.parentnodeid
) SELECT
depts_index
FROM
t2
)
AND
a.systype = #{sysIndex}
AND c.line_index = a.line_index
AND c.dev_index
= b.dev_index
AND b.devflag = 0
AND b.devmodel = 1
</select>
<select id="getPointIndexbyVoltage" resultType="java.lang.Integer" databaseId="Oracle">
select 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.devflag = 0
and b.devmodel = 1
and c.scale = #{guid}
</select>
<select id="getPointIndexbyVoltage" resultType="java.lang.Integer"
databaseId="MariaDB">>
select a.line_index
from pqs_deptsline a, pq_device b,
pq_line c
where a.depts_index in (
WITH recursive t2 AS (
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1 where t1.parentnodeid =
#{deptsIndex} UNION ALL
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1,
t2
WHERE
t1.parentnodeid = #{deptsIndex}
and t1.depts_index
= t2.parentnodeid
) SELECT
depts_index
FROM
t2
)
and a.systype = #{sysIndex}
and c.line_index = a.line_index
and c.dev_index = b.dev_index
and
b.devflag = 0
and b.devmodel = 1
and c.scale = #{guid}
</select>
<select id="getPointIndexbyType" resultType="java.lang.Integer" databaseId="Oracle">
select a.line_index
from pqs_deptsline a, pq_device b, pq_line c, pq_linedetail d
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.devflag = 0
and b.devmodel = 1
and c.line_index = d.line_index and d.loadtype = #{guid}
</select>
<select id="getPointbyMonitor" resultType="java.lang.Integer" databaseId="Oracle">
select a.line_index
from pqs_deptsline a, pq_device b, pq_line c, pq_linedetail d
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.devflag = 0
and b.devmodel = 1
and c.line_index = d.line_index
<choose>
<when test="guid == 0">
and d.monitor_id is not null
</when>
<otherwise>
and d.monitor_id is null
</otherwise>
</choose>
</select>
<select id="getPointIndexbyType" resultType="java.lang.Integer"
databaseId="MariaDB">
select a.line_index
from pqs_deptsline a, pq_device b,
pq_line c, pq_linedetail d
where a.depts_index in (
WITH recursive t2 AS
(
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1 where
t1.parentnodeid = #{deptsIndex} UNION ALL
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1,
t2
WHERE
t1.parentnodeid = #{deptsIndex}
and t1.depts_index = t2.parentnodeid
) SELECT
depts_index
FROM
t2
)
and
a.systype = #{sysIndex}
and c.line_index = a.line_index
and c.dev_index
= b.dev_index
and b.devflag = 0
and b.devmodel = 1
and c.line_index =
d.line_index and d.loadtype = #{guid}
</select>
<select id="getPointbyMonitor" resultType="java.lang.Integer"
databaseId="MariaDB">
select a.line_index
from pqs_deptsline a, pq_device b, pq_line c,
pq_linedetail d
where a.depts_index in (
WITH recursive t2 AS (
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1 where t1.parentnodeid =
#{deptsIndex} UNION ALL
SELECT
t1.depts_index,
t1.parentnodeid
FROM
pqs_depts t1,
t2
WHERE
t1.parentnodeid = #{deptsIndex}
and t1.depts_index
= t2.parentnodeid
) SELECT
depts_index
FROM
t2
)
and a.systype = #{sysIndex}
and c.line_index =
a.line_index
and c.dev_index = b.dev_index
and
b.devflag = 0
and
b.devmodel = 1
and c.line_index = d.line_index
<choose>
<when test="guid == 0">
and d.monitor_id is not null
</when>
<otherwise>
and d.monitor_id is null
</otherwise>
</choose>
</select>
<select id="getDeptsLineIndexs" resultType="java.lang.Integer">
select distinct (a.line_index)
from pqs_deptsline a, pq_device b, pq_line c
where a.depts_index = #{deptsIndex}
and a.systype = #{sysIndex}
and c.line_index = a.line_index
and c.dev_index = b.dev_index
and b.devflag = 0
and b.devmodel = 1
</select>
<select id="getVoltageData" resultType="com.njcn.pojo.data.Legder$Data">
select count(a.line_index) lineCount,
count(distinct a.sub_index) gdCount,
count(distinct a.dev_index) subCount,
a.scale dicIndex,
b.dic_name dicName
from pq_line a, pqs_dicdata b, pq_linedetail c
where a.scale = b.dic_index
and a.line_index = c.line_index
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="listVoltage != null">
and a.scale in
<foreach collection="listVoltage" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</if>
<if test="nature != -1">
and c.powerid = #{nature}
</if>
group by a.scale, b.dic_name
</select>
<select id="getTypeData" resultType="com.njcn.pojo.data.Legder$Data">
select count(a.line_index) lineCount,
count(distinct a.sub_index) gdCount,
count(distinct a.dev_index) subCount,
c.loadtype dicIndex,
b.dic_name dicName
from pq_line a, pqs_dicdata b, pq_linedetail c
where c.loadtype = b.dic_index
and a.line_index = c.line_index
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="listType != null">
and c.loadtype in
<foreach collection="listType" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</if>
<if test="nature != -1">
and c.powerid = #{nature}
</if>
group by c.loadtype, b.dic_name
</select>
<select id="getFactoryData" resultType="com.njcn.pojo.data.Legder$Data">
select count(a.line_index) lineCount,
count(distinct a.sub_index) gdCount,
count(distinct a.dev_index) subCount,
c.manufacturer dicIndex,
b.dic_name dicName
from pq_line a, pqs_dicdata b, pq_devicedetail c,pq_linedetail d
where c.dev_index = a.dev_index
and c.manufacturer = b.dic_index
and a.line_index = d.line_index
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="listFactory != null">
and c.manufacturer in
<foreach collection="listFactory" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</if>
<if test="nature != -1">
and d.powerid = #{nature}
</if>
group by c.manufacturer, b.dic_name
</select>
<select id="getMonitorData" resultType="com.njcn.pojo.data.Legder$Data">
select count(a.line_index) lineCount,
count(distinct a.sub_index) gdCount,
count(distinct a.dev_index) subCount,
c.monitor_id dicIndex
from pq_line a, pq_linedetail c
where c.line_index = a.line_index and
a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="appear != -1 and appear != null">
<choose>
<when test="appear == 0">
and c.monitor_id is not null
</when>
<otherwise>
and c.monitor_id is null
</otherwise>
</choose>
</if>
<if test="nature != -1">
and c.powerid = #{nature}
</if>
group by c.monitor_id
</select>
<select id="getGwLinesByDeviceType" resultType="Integer">
SELECT
t3.LINE_INDEX
FROM
PQ_LINEDETAIL t3
WHERE
MONITOR_ID IS NOT NULL
AND t3.LINE_INDEX IN (
SELECT
t2.LINE_INDEX
FROM
PQ_LINE t2
WHERE
t2.DEV_INDEX IN (
SELECT
t1.DEV_INDEX
FROM
pq_device t1
WHERE
t1.DATATYPE IN
<foreach collection="type" open="(" close=")" separator="," item="item">
#{item}
</foreach>
))
</select>
<select id="siftLineIndexs" resultType="Integer">
select a.line_index
from pq_line a, pq_linedetail b, pq_device c, pq_devicedetail d
where b.line_index = a.line_index
and c.dev_index = a.dev_index
and d.dev_index = c.dev_index
<if test="scale != null">
<if test="scale != 'null'">
and a.scale = #{scale}
</if>
</if>
<if test="manc != null">
<if test="manc != 'null'">
and d.manufacturer = #{manc}
</if>
</if>
<if test="loadtype != null">
<if test="loadtype != 'null'">
and b.loadtype = #{loadtype}
</if>
</if>
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</select>
<select id="siftAllIndexs" resultType="IndexsCount">
select a.line_index lineIndex,a.dev_index devIndex,a.sub_index subIndex,a.gd_index gdIndex
from pq_line a, pq_linedetail b, pq_device c, pq_devicedetail d
where b.line_index = a.line_index
and c.dev_index = a.dev_index
and d.dev_index = c.dev_index
<if test="scale != null">
<if test="scale != 'null'">
and a.scale = #{scale}
</if>
</if>
<if test="manc != null">
<if test="manc != 'null'">
and d.manufacturer = #{manc}
</if>
</if>
<if test="loadtype != null">
<if test="loadtype != 'null'">
and b.loadtype = #{loadtype}
</if>
</if>
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</select>
<resultMap type="Tree" id="lineResultMap" autoMapping="true">
<id column="line_index" property="nodeIndex"/>
<result column="subv_index" property="pId"/>
</resultMap>
<select id='getTreeBySubv' resultMap='lineResultMap'>
select
a.subv_index, a.name,a.line_index,b.devflag as state,b.status,d.pttype
from pq_line a,pq_device b ,pq_subvoltage c,pq_linedetail d
where
a.dev_index = b.dev_index
and a.line_index = d.line_index
and a.subv_index = c.subv_index
and c.subv_index = #{subvIndex}
and a.line_index in
<foreach collection="list" index="index" item="item" open="(" separator="," close=") order by subv_index">
#{item}
</foreach>
</select>
<select id="getAreaBytime" resultType="com.njcn.pojo.data.InfoData">
select count(distinct c.myindex) countTotal, c.timeid totalDate, #{index} as dicIndex,#{index} as dicName
from limit_rate c
where c.myindex in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="sysType == 1">
and ${typeName}
</if>
and c.timeid between #{start} and #{end}
and c.phasic_type = 'T'
group by c.timeid
</select>
<select id="getVoltageBytime" resultType="com.njcn.pojo.data.InfoData">
select count(distinct c.myindex) countTotal,
c.timeid totalDate,
b.dic_index dicIndex,
b.dic_name dicName
from limit_rate c, pq_line a, pqs_dicdata b
where c.myindex in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="sysType == 1">
and ${typeName}
</if>
and c.timeid between #{start} and #{end}
and c.phasic_type = 'T'
and a.line_index = c.myindex
and a.scale = b.dic_index
group by c.timeid, b.dic_index, b.dic_name
</select>
<select id="getLoadTypeBytime" resultType="com.njcn.pojo.data.InfoData">
select count(distinct c.myindex) countTotal,
c.timeid totalDate,
b.dic_index dicIndex,
b.dic_name dicName
from limit_rate c, pq_linedetail a, pqs_dicdata b
where c.myindex in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="sysType == 1">
and ${typeName}
</if>
and c.timeid between #{start} and #{end}
and c.phasic_type = 'T'
and a.line_index = c.myindex
and a.loadtype = b.dic_index
group by c.timeid, b.dic_index, b.dic_name
</select>
<select id="getMonitorBytime" resultType="com.njcn.pojo.data.InfoData">
select count(distinct c.myindex) countTotal,
c.timeid totalDate,
a.monitor_id dicName
from limit_rate c, pq_linedetail a
where c.myindex in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
<if test="sysType == 1">
and ${typeName}
</if>
and c.timeid between #{start} and #{end}
and c.phasic_type = 'T'
and a.line_index = c.myindex
group by c.timeid, a.monitor_id
</select>
<select id="getVoltage" resultType="com.njcn.pojo.data.InfoData">
select distinct (b.dic_index) dicIndex, b.dic_name dicName
from pq_line a, pqs_dicdata b
where a.scale = b.dic_index
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</select>
<select id="getLoadType" resultType="com.njcn.pojo.data.InfoData">
select distinct (b.dic_index) dicIndex, b.dic_name dicName
from pq_linedetail a, pqs_dicdata b
where a.loadtype = b.dic_index
and a.line_index in
<foreach collection="list" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</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,105 @@
<?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="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>
<resultMap type="Tree" id="gdResultMap" autoMapping="true">
<id column="Gd_index" property="nodeIndex"/>
<result column="province_index" property="pId"/>
</resultMap>
<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>
<resultMap type="Tree" id="subResultMap" autoMapping="true">
<id column="Sub_index" property="nodeIndex"/>
<result column="gd_index" property="pId"/>
</resultMap>
<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>
<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>
<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.gd_index in
<foreach collection="list" index="index" item="item" open="("
separator="," close=") order by a.line_index">
#{item}
</foreach>
</select>
<select id='getTreeBySubv' resultMap='lineResultMap'>
select
a.subv_index, a.name,a.line_index,b.devflag as state,b.status,d.pttype
from pq_line a,pq_device b ,pq_subvoltage c,pq_linedetail d
where
a.dev_index = b.dev_index
and a.line_index = d.line_index
and a.subv_index = c.subv_index
and c.subv_index = #{subvIndex}
</select>
</mapper>

View File

@@ -0,0 +1,446 @@
<?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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_i
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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="getPl" resultType="historyData">
select TIMEID timeId,Freq fAvrValue,Freq_MAX fMaxValue,Freq_MIN fMinValue
,Freq_CP95 fCP95Value from data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmrate_v
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_i
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmpower_p
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmpower_p
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmpower_q
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmpower_q
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmpower_s
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_harmpower_s
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_i
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_plt
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_flicker
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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 data_fluc
where
<if test="_databaseId == 'MariaDB'">
str_to_date(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>
</mapper>

View File

@@ -0,0 +1,73 @@
<?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="com.njcn.pojo.data.LimitRate" id="limitRate"
autoMapping="true">
</resultMap>
<select id="sumlimitRate" resultType="java.lang.Long">
select t.freq_dev_overtime+
t.voltage_dev_overtime+
t.ubalance_overtime+
t.flicker_overtime+
t.uaberrance_overtime+
t.uharm_2_overtime+
t.uharm_3_overtime+
t.uharm_4_overtime+
t.uharm_5_overtime+
t.uharm_6_overtime+
t.uharm_7_overtime+
t.uharm_8_overtime+
t.uharm_9_overtime+
t.uharm_10_overtime+
t.uharm_11_overtime+
t.uharm_12_overtime+
t.uharm_13_overtime+
t.uharm_14_overtime+
t.uharm_15_overtime+
t.uharm_16_overtime+
t.uharm_17_overtime+
t.uharm_18_overtime+
t.uharm_19_overtime+
t.uharm_20_overtime+
t.uharm_21_overtime+
t.uharm_22_overtime+
t.uharm_23_overtime+
t.uharm_24_overtime+
t.uharm_25_overtime+
t.iharm_2_overtime+
t.iharm_3_overtime+
t.iharm_4_overtime+
t.iharm_5_overtime+
t.iharm_6_overtime+
t.iharm_7_overtime+
t.iharm_8_overtime+
t.iharm_9_overtime+
t.iharm_10_overtime+
t.iharm_11_overtime+
t.iharm_12_overtime+
t.iharm_13_overtime+
t.iharm_14_overtime+
t.iharm_15_overtime+
t.iharm_16_overtime+
t.iharm_17_overtime+
t.iharm_18_overtime+
t.iharm_19_overtime+
t.iharm_20_overtime+
t.iharm_21_overtime+
t.iharm_22_overtime+
t.iharm_23_overtime+
t.iharm_24_overtime+
t.iharm_25_overtime
from LIMIT_RATE t
where TIMEID = #{timeId}
and MYINDEX = #{lineIndex}
and PHASIC_TYPE = 'T'
</select>
<select id="selectLimitRate" resultType="limitRate">
select * from LIMIT_RATE
where TIMEID = #{timeId}
and MYINDEX = #{lineIndex}
and PHASIC_TYPE = 'T'
</select>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.pqs9300.mapper.flowChart.FlowChartMapper'>
<select id="getPowerLever" resultType="String" >
SELECT
c.DIC_NAME
FROM
THS_SUPERVISE a,
THS_OVERRUNLOG b,
PQS_DICDATA c,
PQ_LINE d
WHERE
a.SUP_INDEX = b.SUP_INDEX
AND
a.SUP_INDEX = #{flowChartSupIndex}
AND
b.LINE_INDEX = d.LINE_INDEX
AND
d.SCALE = c.DIC_INDEX
AND
ROWNUM = 1
</select>
<select id="getProgress" resultType="Integer" >
SELECT
PROGRESS
FROM
THS_SUPERVISE
WHERE
SUP_INDEX = #{supIndex}
</select>
</mapper>

View File

@@ -0,0 +1,166 @@
<?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.pqs9300.mapper.formdata.FormDataMapper'>
<resultMap id="limitRateDataDto" type="com.pqs9300.pojo.formdata.LimitRateDto" autoMapping="true">
<result property="lineIndex" column="lineIndex"></result>
<result property="bdName" column="bdName"/>
<result property="lineName" column="lineName"/>
<result property="times" column="times"/>
<association property="limitRate" javaType="com.njcn.pojo.data.LimitRate" autoMapping="true">
<id property="myIndex" column="myIndex"></id>
</association>
</resultMap>
<select id="getListDepts" resultType="com.pqs9300.pojo.formdata.FormData">
select distinct (a.depts_index) deptsIndex, b.deptsname deptsName, b.custom_dept customDept
from pqs_deptsline a, pqs_depts b
where a.systype = #{sysType}
and a.depts_index = b.depts_index
</select>
<select id="getListDeptsByIndex" resultType="com.pqs9300.pojo.formdata.FormData">
select depts_index deptsIndex, deptsname deptsName, custom_dept customDept
from pqs_depts
where depts_index in
<foreach collection="deptsIndex" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="getListLineByDepts" resultType="java.lang.Long">
select a.line_index
from pqs_deptsline a, pq_line b
where a.depts_index = #{deptsIndex}
and a.systype = #{sysType}
and a.line_index = b.line_index
<foreach collection="level" index="index" item="item" separator="," open="and b.scale in ("
close=")">
#{item}
</foreach>
</select>
<select id="getOptionList" resultType="java.lang.String">
select dic_name from pqs_dicdata where dic_index in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<insert id="insertSuperData" parameterType="com.pqs9300.pojo.formdata.FormData">
insert into ths_supervise
(sup_index, name, depts, create_user, create_time, type, progress,modify_time,eventDate)
values
(#{formData.supIndex},#{formData.supName},#{formData.deptsIndex},#{formData.createUser},#{formData.createTime},#{type},0,#{formData.createTime},#{formData.eventDate})
</insert>
<insert id="insertOverData">
insert into ths_overrunlog (line_index,sup_index,updatetime,overrun_describe,overruntimes,name)
values (#{lineId},#{supIndex},#{time},#{des},#{times},#{name})
</insert>
<delete id="deleteBySupIndex">
delete from ths_overrunlog where sup_Index = #{supIndex}
</delete>
<select id="getLimitRate" resultMap="limitRateDataDto">
select ${conditionData.conditionResult},b.timeid times, c.line_index lineIndex,c.line_name lineName,d.name
bdName,e.name gdName,c.line_index myIndex,b.timeid timeID
from pqs_deptsline a, limit_rate b, pq_linedetail c, pq_substation d,PQ_GDINFORMATION e
where (1=1
<if test="conditionData.listExitLoadType!=null and conditionData.listExitLoadType.size() &gt; 0">
and c.loadtype in
<foreach collection="conditionData.listExitLoadType" index="index" item="item" separator="," open="("
close=")">
#{item}
</foreach>
</if>
<if test="conditionData.listExitLoadType!=null and conditionData.listExitLoadType.size() &gt; 0 and conditionData.listExitsLine!=null and conditionData.listExitsLine.size()&gt;0">
<foreach collection="conditionData.listExitsLine" index="index" item="lineId" separator=","
open="or c.line_index in("
close=")">
#{lineId}
</foreach>
</if>
<if test="conditionData.listExitLoadType!=null and conditionData.listExitLoadType.size() == 0 and conditionData.listExitsLine!=null and conditionData.listExitsLine.size()&gt;0">
and c.line_index in
<foreach collection="conditionData.listExitsLine" index="index" item="lineId" separator=","
open="("
close=")">
#{lineId}
</foreach>
</if>
)
and a.depts_index = #{conditionData.deptsIndex}
and a.systype = #{conditionData.sysType}
and b.phasic_type = 'T'
and c.line_index = a.line_index
and c.line_index = b.myindex
and b.timeid between #{conditionData.startTime} and #{conditionData.endTime}
and (${conditionData.condition})
and c.sub_index = d.sub_index
and c.gd_index = e.gd_index
</select>
<select id="getUserIndexByDeptsIndex" resultType="java.lang.String">
select b.user_index
from pqs_userset b
where b.depts_index in
(select a.depts_index
from pqs_depts a
start with a.depts_index = #{deptsIndex}
connect by nocycle prior a.parentnodeid = a.depts_index)
</select>
<select id="getLevel" resultType="com.njcn.pojo.configuration.DicData">
select b.dic_name dicName, b.dic_index dicIndex
from pqs_dictype a, pqs_dicdata b
where a.dictype_name = #{name}
and a.dictype_index = b.dic_type
</select>
<select id="getExistLog" resultType="com.pqs9300.pojo.transaction.OverRunLog">
select *
from ths_overrunlog
where updatetime = #{start}
and sup_index in (select sup_index from ths_supervise where type = #{type})
</select>
<select id="getLogBySupIndex" resultType="com.pqs9300.pojo.transaction.OverRunLog">
select a.*, b.name as gdName, c.name as subName, d.name as lineName
from ths_overrunlog a, pq_gdinformation b, pq_substation c, pq_line d
where d.line_index = a.line_index
and b.gd_index = d.gd_index
and c.sub_index = d.sub_index
and sup_index = #{supIndex}
</select>
<select id="getStrategyLineByDept" resultType="java.lang.Long">
select b.wfass_index from ths_warnform a
left join ths_warnformass b on a.WF_INDEX = b.WF_INDEX
left join pqs_userset c on a.user_index=c.user_index
where a.state = 1
and a.grade=#{grade}
and b.type = 2
and c.depts_index in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="getAlarmStrategyLineByDept" resultType="java.lang.Long">
select b.alarmass_index from ths_alarm a
left join ths_alarmass b on a.alarm_index = b.alarm_index
left join pqs_userset c on a.user_index=c.user_index
where a.state = 1
and a.grade=#{grade}
and b.type = 2
and c.depts_index in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,285 @@
<?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" databaseId="Oracle">
select t.dictype_name as type,
a.back_up as name,
u.USERLOG_DESCRIBE as describe,
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="getUserLog" resultMap="UserLogDetailMapperMap" databaseId="MariaDB">
select t.dictype_name as type,
a.dic_name as name,
u.USERLOG_DESCRIBE as `describe`,
u.updatetime as updatetime,
u.ip as ip,
(case a.DIC_LEAVE when 0 then '普通' when 1 then '中等' else '严重' end) 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" databaseId="Oracle">
select u.USERLOG_INDEX as userLogIndex,
t.dictype_name as type,
a.back_up as name,
m.LOGINNAME as username,
u.USERLOG_DESCRIBE as userlogDescribe,
u.result as result,
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,
pqs_user m
where u.type=a.dic_index
and u.user_index in (m.user_index,m.loginname)
and a.dic_type=t.dictype_index
<if test="username != ''">
and m.LOGINNAME = #{username}
</if>
and t.dictype_index like #{type}
and a.back_up like #{name}
and u.updatetime between #{startTime}
and #{endTime}
order by u.updatetime desc
</select>
<select id="getUserLogId" resultMap="UserLogDetailMapperMap" databaseId="MariaDB">
select u.USERLOG_INDEX as userLogIndex,
t.dictype_name as type,
a.back_up as name,
m.LOGINNAME as username,
u.USERLOG_DESCRIBE as userlogDescribe,
u.result as result,
u.updatetime as updatetime,
u.ip as ip,
(case a.DIC_LEAVE when 0 then '普通' when 0 then '中等' else '严重' end) as leval
from pqs_userlog u ,
pqs_dicdata a ,
pqs_dictype t,
pqs_user m
where u.type=a.dic_index
and u.user_index in (m.user_index,m.loginname)
and a.dic_type=t.dictype_index
<if test="username != ''">
and m.LOGINNAME = #{username}
</if>
and t.dictype_index like #{type}
and a.back_up like #{name}
and u.updatetime between #{startTime}
and #{endTime}
order by u.updatetime desc
</select>
<!-- 统计事件类型 -->
<select id="geteventtype" resultMap="UserLogDetailMapperMap" databaseId="Oracle">
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 u.updatetime between #{startTime}
and #{endTime}
group by t.dictype_name
</select>
<select id="geteventtype" resultMap="UserLogDetailMapperMap" databaseId="MariaDB">
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 u.updatetime 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
u.updatetime between #{startTime}
and #{endTime}
group by a.dic_name
</select>
<!-- 统计用户统计 -->
<select id="getUserStatistics" resultMap="UserLogDetailMapperMap" databaseId="Oracle">
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 a.updatetime between #{startTime}
and #{endTime}
group by b.loginname
</select>
<select id="getUserStatistics" resultMap="UserLogDetailMapperMap" databaseId="MariaDB">
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 a.updatetime between #{startTime}
and #{endTime}
group by b.loginname
</select>
<select id="getdetailmonth" resultType="Integer">
select count(*) from pqs_userlog where to_char(updatetime,'YYYY-MM') = #{month}
</select>
<!-- 查询中等日志 -->
<select id="getWarnInfo" resultMap="UserLogDetailMapperMap" databaseId="Oracle">
select u.USERLOG_INDEX as userLogIndex,
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 a.DIC_LEAVE in (1,2)
and u.state = 0
order by u.updatetime desc
</select>
<!-- 查询中等日志 -->
<select id="getWarnInfo" resultMap="UserLogDetailMapperMap" databaseId="MariaDB">
select u.USERLOG_INDEX as userLogIndex,
t.dictype_name as type,
a.dic_name as name,
u.USERLOG_DESCRIBE as UserlogDescribe,
u.updatetime as updatetime,
u.ip as ip,
(case a.DIC_LEAVE when 0 then '普通' when 0 then '中等' else '严重' end) 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 a.DIC_LEAVE in (1,2)
and u.state = 0
order by u.updatetime desc
</select>
<!-- 查询严重日志 -->
<select id="getDangerInfo" resultMap="UserLogDetailMapperMap" databaseId="Oracle">
select u.USERLOG_INDEX as userLogIndex,
u.USER_INDEX as userIndex,
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 a.DIC_LEAVE = 2
and u.state = 0
order by u.updatetime desc
</select>
<!-- 查询严重日志 -->
<select id="getDangerInfo" resultMap="UserLogDetailMapperMap" databaseId="MariaDB">
select u.USERLOG_INDEX as userLogIndex,
u.USER_INDEX as userIndex,
t.dictype_name as type,
a.dic_name as name,
u.USERLOG_DESCRIBE as UserlogDescribe,
u.updatetime as updatetime,
u.ip as ip,
(case a.DIC_LEAVE when 0 then '普通' when 0 then '中等' else '严重' end) 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 a.DIC_LEAVE = 2
and u.state = 0
order by u.updatetime desc
</select>
<update id="changeState">
update pqs_userlog set state = 1 where USERLOG_INDEX in
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<!-- 查询userlog表存储空间 -->
<select id="getMemoInfo" resultType="Float" databaseId="Oracle">
select num_rows * avg_row_len/1024/1024 from user_tables where table_name ='PQS_USERLOG'
</select>
<select id="getMemoInfo" resultType="Float" databaseId="MariaDB">
select data_length/1024/1024
from information_schema.tables where table_name = 'pqs_userlog'
group by TABLE_NAME
order by data_length desc
</select>
<select id="getSjtj" resultMap="UserLogDetailMapperMap">
select a.back_up as name,
m.LOGINNAME as username,
count(u.userlog_index) as num
from pqs_userlog u ,
pqs_dicdata a ,
pqs_dictype t,
pqs_user m
where u.type=a.dic_index
and u.user_index in (m.user_index,m.loginname)
and a.dic_type=t.dictype_index
<if test="username != ''">
and m.LOGINNAME = #{username}
</if>
and t.dictype_index like #{type}
and a.back_up like #{name}
and u.updatetime between #{startTime}
and #{endTime}
group by a.back_up, m.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,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.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">
SELECT
*
FROM
(
SELECT
*
FROM
PQS_USERLOGIN
WHERE
USER_INDEX=#{userIndex}
ORDER BY
LOGINTIME DESC
)
WHERE
ROWNUM = 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.pqs9300.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>
</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.pqs9300.mapper.report.GetDistortionDataMapper">
<select id="getDistortionData" resultType="ReportValue">
select phasic_type phaseType,max(${str}_THD_MAX) fmaxValue,min(${str}_THD_MIN) minValue,round(avg(${str}_THD) ,2)
meanValue,max(case when ${str}THDCP95 =#{condition.count} then ${str}_THD else null end)
cp95Value from ( select t.*,row_number() over (partition by phasic_type order by ${str}_THD desc) ${str}THDCP95
from
<choose>
<when test="condition.b == true">
Data_${str}
</when>
<otherwise>
Day_${str}
</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,31 @@
<?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.pqs9300.mapper.report.GetFpyMapper">
<select id="getFpy" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
<choose>
<when test="flag != 2">
<foreach collection="list" item="item" separator="," close=",">
sum(UHarm_${item}_OverTime) UHarm_${item}_OverTime,sum(IHarm_${item}_OverTime)
IHarm_${item}_OverTime
</foreach>
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.pqs9300.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.pqs9300.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,131 @@
<?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.pqs9300.mapper.report.GetICurrentMapper">
<select id="getICurrent" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
<foreach collection="listValue" item="item" separator=",">
max(I_${item}_MAX) I_${item}_MAX,min(I_${item}_MIN) I_${item}_MIN,round(avg(I_${item}) ,2) I_${item}
,max(case when I${item}CP95 =#{condition.count} then I_${item} else null end) I_${item}_CP95
</foreach>
from ( select t.*,
<foreach collection="listValue" item="item" separator=",">
row_number() over (partition by phasic_type order by I_${item} desc) I${item}CP95
</foreach>
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>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.pqs9300.mapper.report.GetInICurrentMapper">
<select id="getICurrent" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
<foreach collection="listValue" item="item" separator=",">
max(I_${item}_MAX) I_${item}_MAX,min(I_${item}_MIN) I_${item}_MIN,round(avg(I_${item}) ,2) I_${item}
,max(case when I${item}CP95 =#{condition.count} then I_${item} else null end) I_${item}_CP95
</foreach>
from ( select t.*,
<foreach collection="listValue" item="item" separator=",">
row_number() over (partition by phasic_type order by I_${item} desc) I${item}CP95
</foreach>
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,61 @@
<?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.pqs9300.mapper.report.GetInVoltageRateMapper">
<select id="getInVoltageRate" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
<foreach collection="listValue" item="item" separator=",">
max(V_${item}_MAX) V_${item}_MAX,min(V_${item}_MIN) V_${item}_MIN,round(avg(V_${item}) ,2) V_${item}
,max(case when V${item}CP95 =#{condition.count} then V_${item} else null end) V_${item}_CP95
</foreach>
from ( select t.*,
<foreach collection="listValue" item="item" separator=",">
row_number() over (partition by phasic_type order by V_${item} desc) V${item}CP95
</foreach>
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,43 @@
<?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.pqs9300.mapper.report.GetPowerDataMapper">
<select id="getPower" resultType="ReportValue">
select phasic_type phaseType, max(${str}_MAX) fmaxValue,min(${str}_MIN) minValue,round(avg(${str}) ,2)
meanValue,max(case when ${str}CP95 = #{condition.count} then ${str} else null end) cp95Value
from ( select t.*,row_number() over (partition by phasic_type order by ${str} desc) ${str}CP95 from
<choose>
<when test="condition.b == true">
Data_HarmPower_${str}
</when>
<otherwise>
Day_HarmPower_${str}
</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
Data_HarmPower_P 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,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.pqs9300.mapper.report.GetThreephaseDataMapper">
<select id="getThreephase" resultType="java.util.HashMap">
select max(${str}_Unbalance_MAX) ${str}_Unbalance_MAX,min(${str}_Unbalance_MIN)
${str}_Unbalance_MIN,round(avg(${str}_Unbalance) ,2) ${str}_Unbalance,
max(CASE WHEN ${str}unbalancecp95 = #{condition.count}
THEN ${str}_Unbalance
ELSE NULL END) ${str}_Unbalance_CP95
,max(${str}_Pos_MAX) ${str}_Pos_MAX,min(${str}_Pos_MIN) ${str}_Pos_MIN,round(avg(${str}_Pos) ,2)
${str}_Pos,
max(CASE WHEN ${str}poscp95 = #{condition.count}
THEN ${str}_Pos
ELSE NULL END) ${str}_Pos_CP95
,max(${str}_Neg_MAX) ${str}_Neg_MAX,min(${str}_Neg_MIN) ${str}_Neg_MIN,round(avg(${str}_Neg) ,2)
${str}_Neg,
max(CASE WHEN ${str}negcp95 = #{condition.count}
THEN ${str}_Neg
ELSE NULL END) ${str}_Neg_CP95
,max(${str}_Zero_MAX) ${str}_Zero_MAX,min(${str}_Zero_MIN) ${str}_Zero_MIN,round(avg(${str}_Zero) ,2)
${str}_Zero,
max(CASE WHEN ${str}zerocp95 = #{condition.count}
THEN ${str}_Zero
ELSE NULL END) ${str}_Zero_CP95
FROM (SELECT
t.*,
row_number() over (partition BY phasic_type ORDER BY ${str}_Unbalance DESC) ${str}unbalancecp95,
row_number() over (partition BY phasic_type ORDER BY ${str}_Pos DESC) ${str}poscp95,
row_number() over (partition BY phasic_type ORDER BY ${str}_Neg DESC) ${str}negcp95,
row_number() over (partition BY phasic_type ORDER BY ${str}_Zero DESC) ${str}zerocp95
from
<choose>
<when test="condition.b == true">
data_${str}
</when>
<otherwise>
day_${str}
</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.pqs9300.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,121 @@
<?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.pqs9300.mapper.report.GetVirtualDataMapper">
<select id="getTotalCP95" resultType="java.lang.Integer">
SELECT count(rms) total
FROM ${tableName}
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="getTotalPltCP95" resultType="java.lang.Integer">
SELECT count(plt) total
FROM ${tableName}
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="getTotalPstCP95" resultType="java.lang.Integer">
SELECT count(pst) total
FROM ${tableName}
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="getVirtualData" 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_${tableName}
</when>
<otherwise>
day_${tableName}
</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.pqs9300.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,69 @@
<?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.pqs9300.mapper.report.GetVoltageRateMapper">
<select id="getVoltageRate" resultType="java.util.HashMap">
select phasic_type PHASETYPE,
<foreach collection="listValue" item="item" separator=",">
max(V_${item}_MAX) V_${item}_MAX,min(V_${item}_MIN) V_${item}_MIN,round(avg(V_${item}) ,2) V_${item}
,max(case when V${item}CP95 =#{condition.count} then V_${item} else null end) V_${item}_CP95
</foreach>
from ( select t.*,
<foreach collection="listValue" item="item" separator=",">
row_number() over (partition by phasic_type order by V_${item} desc) V${item}CP95
</foreach>
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,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.excelreport.PercentMapper">
<select id="getFpy" resultType="com.njcn.pojo.data.LimitRate">
select
<foreach collection="list" item="item" separator="," close=",">
sum(UHarm_${item}_OverTime) UHarm${item}OverTime,sum(IHarm_${item}_OverTime)
IHarm${item}OverTime
</foreach>
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,79 @@
<?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,
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,
d.name pName,
e.name bdName
FROM pq_line a,
pqs_dicdata b,
pq_device c,
pq_subvoltage d,
pq_substation e
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 = #{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>
</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.pqs9300.mapper.strategy.AlarmImplWarning'>
<select id="getEarlyWarnListbyGrade" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormDTO">
select a.alarm_index as wfIndex,
a.alarm_name as wfName,
a.grade as grade,
a.OPERATION as operation,
a.USER_INDEX as userIndex,
a.UPDATETIME as updateTime,
b.NAME as userName
from ths_alarm a
left join pqs_user b
on a.USER_INDEX = b.USER_INDEX
where a.STATE = 1
and a.grade = #{grade}
order by a.UPDATETIME desc
</select>
<select id="getEarlyWarnAssBywfIndex" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormAss">
select alarm_INDEX as wfIndex, alarmASS_INDEX as wfassIndex, TYPE as type
from ths_alarmass
where alarm_INDEX = #{wfIndex}
</select>
<select id="getEarlyWarnAssByGrade" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormAss">
select a.type type, a.alarmass_index wfassIndex
from ths_alarmass a, ths_alarm b
where a.alarm_index = b.alarm_index
and b.state = 1
and b.grade = #{grade}
</select>
</mapper>

View File

@@ -0,0 +1,158 @@
<?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.pqs9300.mapper.strategy.AlarmStrategyMapper'>
<insert id="addAlarm">
insert into ths_alarm
(
ALARM_INDEX,
ALARM_NAME,
GRADE,
OPERATION,
USER_INDEX,
UPDATETIME
)values
(
#{alarmIndex},
#{alarmName},
#{grade},
#{operation},
#{userIndex},
#{updateTime}
)
</insert>
<update id="updateAlarm">
update ths_alarm set
ALARM_NAME=#{alarmName},
GRADE=#{grade},
USER_INDEX=#{userIndex},
UPDATETIME=#{updateTime}
where
ALARM_INDEX=#{alarmIndex}
</update>
<!--是否启用-->
<update id="statusController">
update ths_alarm set
STATE = #{state}
where
ALARM_INDEX=#{alarmIndex}
</update>
<!--指标类型与或修改-->
<update id="updateAlarmAndOr">
update ths_alarm set
OPERATION=#{operation}
where
ALARM_INDEX=#{alarmIndex}
</update>
<update id="delAlarm">
delete from ths_alarm
where ALARM_INDEX = #{alarmIndex}
</update>
<select id="getAlarmList" resultType="com.pqs9300.pojo.strategy.ThsAlarmDTO">
select
a.ALARM_INDEX as alarmIndex,
a.ALARM_NAME as alarmName,
a.GRADE as grade,
a.OPERATION as operation,
a.STATE as state,
a.USER_INDEX as userIndex,
a.UPDATETIME as updateTime,
b.NAME as userName
from ths_alarm a
left join pqs_user b on a.USER_INDEX = b.USER_INDEX and b.state = 1
left join pqs_userset c on b.USER_INDEX =c.user_index
where 1 = 1
<if test="grade!=null">
and a.grade =#{grade}
</if>
<if test="alarmIndex!=null and alarmIndex!=''">
and a.ALARM_INDEX !=#{alarmIndex}
</if>
<if test="list!=null">
and c.depts_index in
<foreach collection="list" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by a.UPDATETIME desc
</select>
<select id="getAlarmById" resultType="com.pqs9300.pojo.strategy.ThsAlarmDTO">
select * from ths_alarm
where ALARM_INDEX=#{alarmIndex}
</select>
<select id="isSameName" resultType="int">
select count(*) from ths_alarm
where ALARM_NAME=#{alarmName}
<if test="alarmIndex!=null and alarmIndex!=''">
and ALARM_INDEX !=#{alarmIndex}
</if>
</select>
<select id="getTartgetTypeForDic" resultType="com.pqs9300.pojo.strategy.DicStrategyRVO">
select a.DIC_INDEX as dicIndex,
a.DIC_NAME as dicName,
a.DIC_TYPE as dicType
from PQS_DICDATA a
left join PQS_DICTYPE b on a.DIC_TYPE = b.DICTYPE_INDEX
where b.DICTYPE_NAME = #{type}
and a.state = 1
</select>
<insert id="addAlarmAss">
insert into ths_alarmass (ALARM_INDEX,ALARMASS_INDEX,TYPE)
<foreach collection="list" item="item" separator="UNION ALL">
select
#{item.wfIndex},
#{item.wfassIndex},
#{item.type}
from DUAL
</foreach>
</insert>
<delete id="delAlarmAss">
delete from ths_alarmass
where
ALARM_INDEX=#{alarmIndex}
</delete>
<select id="getAlarmAss" resultType="com.pqs9300.pojo.strategy.ThsAlarmAss">
select ALARM_INDEX as alarmIndex,
ALARMASS_INDEX as alarmassIndex,
TYPE as type
from ths_alarmass
where ALARM_INDEX =#{alarmIndex}
<if test="type!=null">
and TYPE = #{type}
</if>
</select>
<select id="isExitBindEvent" resultType="int">
select count(*) from ths_alarmass
where ALARM_INDEX = #{alarmIndex}
</select>
<select id="isExitLine" resultType="int">
select count(*) from ths_alarmass a
left join ths_alarm b on a.ALARM_INDEX=b.ALARM_INDEX
where a.ALARMASS_INDEX in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.wfassIndex,jdbcType=VARCHAR}
</foreach>
and b.GRADE=#{grade}
and a.TYPE in
<foreach collection="type" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and a.ALARM_INDEX !=#{alarmIndex}
</select>
</mapper>

View File

@@ -0,0 +1,192 @@
<?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.pqs9300.mapper.strategy.WarningStrategyMapper'>
<insert id="addEarlyWarn">
insert into ths_warnform
(
WF_INDEX,
WF_NAME,
GRADE,
OPERATION,
USER_INDEX,
UPDATETIME
)values
(
#{wfIndex},
#{wfName},
#{grade},
#{operation},
#{userIndex},
#{updateTime}
)
</insert>
<update id="updateEarlyWarn">
update ths_warnform set
WF_NAME=#{wfName},
GRADE=#{grade},
USER_INDEX=#{userIndex},
UPDATETIME=#{updateTime}
where
WF_INDEX=#{wfIndex}
</update>
<!--指标类型与或修改-->
<update id="updateEarlyWarnAndOr">
update ths_warnform set
OPERATION=#{operation}
where
WF_INDEX=#{wfIndex}
</update>
<!--是否启用-->
<update id="statusController">
update ths_warnform set
STATE = #{state}
where
WF_INDEX=#{wfIndex}
</update>
<delete id="delEarlyWarn">
delete from ths_warnform
where
WF_INDEX = #{wfIndex}
</delete>
<select id="getEarlyWarnList" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormDTO">
select
a.WF_INDEX as wfIndex,
a.WF_NAME as wfName,
a.GRADE as grade,
a.OPERATION as operation,
a.STATE as state,
a.USER_INDEX as userIndex,
a.UPDATETIME as updateTime,
b.NAME as userName
from ths_warnform a
left join pqs_user b on a.USER_INDEX = b.USER_INDEX and b.state = 1
left join pqs_userset c on b.USER_INDEX =c.user_index
where 1=1
<if test="grade!=null">
and a.grade =#{grade}
</if>
<if test="wfIndex!=null and wfIndex!=''">
and a.WF_INDEX !=#{wfIndex}
</if>
<if test="list!=null">
and c.depts_index in
<foreach collection="list" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by a.UPDATETIME desc
</select>
<select id="getEarlyWarnById" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormDTO">
select * from ths_warnform
where WF_INDEX=#{wfIndex}
</select>
<select id="isSameName" resultType="int">
select count(*) from ths_warnform
where WF_NAME=#{wfName}
<if test="wfIndex!=null and wfIndex!=''">
and WF_INDEX !=#{wfIndex}
</if>
</select>
<select id="getTartgetTypeForDic" resultType="com.pqs9300.pojo.strategy.DicStrategyRVO">
select a.DIC_INDEX as dicIndex,
a.DIC_NAME as dicName,
a.DIC_TYPE as dicType
from PQS_DICDATA a
left join PQS_DICTYPE b on a.DIC_TYPE = b.DICTYPE_INDEX
where b.DICTYPE_NAME = #{type}
and a.STATE = 1
</select>
<insert id="addEarlyWarnAss">
insert into ths_warnformass (WF_INDEX,WFASS_INDEX,TYPE)
<foreach collection="list" item="item" separator="UNION ALL">
select
#{item.wfIndex},
#{item.wfassIndex},
#{item.type}
from DUAL
</foreach>
</insert>
<delete id="delEarlyWarnAss">
delete from ths_warnformass
where
WF_INDEX=#{wfIndex}
</delete>
<select id="getEarlyWarnAss" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormAss">
select WF_INDEX as wfIndex,
WFASS_INDEX as wfassIndex,
TYPE as type
from ths_warnformass
where WF_INDEX =#{wfIndex}
<if test="type!=null">
and TYPE = #{type}
</if>
</select>
<select id="isExitBindEvent" resultType="int">
select count(*) from ths_warnformass
where WF_INDEX = #{wfIndex}
</select>
<select id="isExitLine" resultType="int">
select count(*) from ths_warnformass a
left join ths_warnform b on a.WF_INDEX = b.WF_INDEX
where a.WFASS_INDEX in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.wfassIndex,jdbcType=VARCHAR}
</foreach>
and b.GRADE=#{grade}
and a.TYPE in
<foreach collection="type" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
and a.WF_INDEX !=#{wfIndex}
</select>
<select id="getEarlyWarnListbyGrade" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormDTO">
select
a.WF_INDEX as wfIndex,
a.WF_NAME as wfName,
a.GRADE as grade,
a.OPERATION as operation,
a.USER_INDEX as userIndex,
a.UPDATETIME as updateTime,
b.NAME as userName
from ths_warnform a
left join pqs_user b on a.USER_INDEX = b.USER_INDEX
where a.STATE = 1 and a.grade = #{grade}
order by a.UPDATETIME desc
</select>
<select id="getEarlyWarnAssBywfIndex" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormAss">
select WF_INDEX as wfIndex,
WFASS_INDEX as wfassIndex,
TYPE as type
from ths_warnformass
where WF_INDEX =#{wfIndex}
</select>
<select id="getEarlyWarnAssByGrade" resultType="com.pqs9300.pojo.strategy.ThsAlarmFormAss">
select a.type type, a.wfass_index wfassIndex
from ths_warnformass a, ths_warnform b
where a.wf_index = b.wf_index
and b.state = 1
and b.grade = #{grade}
</select>
</mapper>

View File

@@ -0,0 +1,99 @@
<?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.pqs9300.mapper.technical.TechnicalInfoMapper'>
<select id="getTechnicalInfo" resultType="com.pqs9300.pojo.technical.TechnicalInfo">
SELECT
supe.SUP_INDEX supIndex,
supe.name supName,
users.NAME userName,
supe.CREATE_TIME creatTime,
depts.DEPTSNAME deptName,
supe.type supType,
supe.MODIFY_TIME modifyTime,
supe.SUP_DESCRIBE supDescribe,
supe.PROGRESS progress
FROM
THS_SUPERVISE supe,
pqs_user users,
PQS_DEPTS depts
WHERE
supe.CREATE_USER = users.USER_INDEX
AND supe.DEPTS = depts.DEPTS_INDEX
and supe.MODIFY_TIME between #{startTime} and #{endTime}
and supe.PROGRESS in
<foreach collection="progress" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
and supe.type in
<foreach collection="supType" item="item" index="index" open="("
separator="," close=")">
#{item}
</foreach>
order by supe.MODIFY_TIME desc
</select>
<update id="getStartSwitch">
<foreach collection="list" item="item" index="index" open="begin" close="; end;" separator=";">
update THS_SUPERVISE set PROGRESS = 1 where SUP_INDEX = #{item}
</foreach>
</update>
<select id="getTransactionDataByDepts" resultType="com.pqs9300.pojo.technical.TechnicalInfo">
select
t1.SUP_INDEX supIndex,
t1.name supName,
t3.NAME userName,
t1.CREATE_TIME creatTime,
t2.DEPTSNAME deptName,
t1.type supType,
t1.MODIFY_TIME modifyTime,
t1.SUP_DESCRIBE supDescribe,
t1.PROGRESS progress
from
THS_SUPERVISE t1,pqs_depts t2,pqs_user t3
where
t1.up_user is null
and t1.MODIFY_TIME between #{startTime} and #{endTime}
and t1.depts in
<foreach collection="deptsIndexs" separator="," open="(" close=")" item="deptsIndex">
#{deptsIndex}
</foreach>
and t1.depts=t2.depts_index
and t1.create_user=t3.user_index
<if test="type != 2">
and t1.type=#{type}
</if>
<if test="progress != 7">
and t1.progress=#{progress}
</if>
</select>
<select id="getTransactionDataByUserIndex" resultType="com.pqs9300.pojo.technical.TechnicalInfo">
select
t1.SUP_INDEX supIndex,
t1.name supName,
t3.NAME userName,
t1.CREATE_TIME creatTime,
t2.DEPTSNAME deptName,
t1.type supType,
t1.MODIFY_TIME modifyTime,
t1.SUP_DESCRIBE supDescribe,
t1.PROGRESS progress
from
THS_SUPERVISE t1,pqs_depts t2,pqs_user t3
where
t1.up_user is not null
and t1.MODIFY_TIME between #{startTime} and #{endTime}
and t1.up_user = #{userIndex}
and t1.depts=t2.depts_index
and t1.create_user=t3.user_index
<if test="type != 2">
and t1.type=#{type}
</if>
<if test="progress != 7">
and t1.progress=#{progress}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,57 @@
<?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.pqs9300.mapper.transaction.OverRunLogMapper'>
<resultMap id="getMonitorDetailDataMap" type="OverRunLogDetail">
<result column="gdName" property="gdName"></result>
<result column="subName" property="subName"></result>
<result column="lineName" property="lineName"></result>
<result column="deptsName" property="deptsName"></result>
<association property="overRunLog" javaType="OverRunLog">
<result column="lineIndex" property="lineIndex"></result>
<result column="OVERRUN_DESCRIBE" property="overRunDescribe"></result>
<result column="SUP_INDEX" property="supIndex"></result>
<result column="feedBack" property="feedBack"></result>
<result column="testReport" property="testReport"></result>
<result column="reviseFeedBack" property="reviseFeedBack"></result>
<result column="updatetime" property="updateTime"></result>
<result column="name" property="name"></result>
</association>
</resultMap>
<select id="getMonitorDetailData" resultMap="getMonitorDetailDataMap" >
SELECT
t4.name gdName,
t3.name subName,
t2.name lineName,
t1.line_index lineIndex,
t1.feedBack,
t1.testReport,
t1.reviseFeedBack,
t1.sup_Index,
t1.OVERRUN_DESCRIBE,
t1.updatetime,
t6.deptsname deptsName,
t1.name
FROM
THS_OVERRUNLOG T1,
PQ_LINE T2,
PQ_SUBSTATION T3,
PQ_GDINFORMATION T4,
pqs_deptsline T5,
pqs_depts T6
WHERE
t1.line_index = t2.line_index
AND t2.sub_index = t3.sub_index
AND t2.gd_index = t4.gd_index
AND t1.line_index = t5.line_index
AND t5.depts_index = t6.depts_index
AND t6.CUSTOM_DEPT = 0
and t1.sup_index=#{supIndex}
</select>
</mapper>

View File

@@ -0,0 +1,64 @@
<?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.pqs9300.mapper.transaction.SuperviseMapper'>
<select id="getTransactionDataByDepts" resultType="Supervise">
select
t1.sup_index,
t1.name,
t2.deptsname depts,
t3.name create_user,
t1.create_time,
t1.modify_time,
t1.type,
t1.progress,
t1.sup_describe
from
THS_SUPERVISE t1,pqs_depts t2,pqs_user t3
where
t1.up_user is null
and t1.create_time between #{startTime} and #{endTime}
and t1.depts in
<foreach collection="deptsIndexs" separator="," open="(" close=")" item="deptsIndex">
#{deptsIndex}
</foreach>
and t1.depts=t2.depts_index
and t1.create_user=t3.user_index
<if test="type != 2">
and t1.type=#{type}
</if>
<if test="progress != 7">
and t1.progress=#{progress}
</if>
</select>
<select id="getTransactionDataByUserIndex" resultType="Supervise">
select
t1.sup_index,
t1.name,
t2.deptsname depts,
t3.name create_user,
t1.create_time,
t4.name modify_user,
t1.modify_time,
t1.type,
t1.progress,
t1.sup_describe
from
THS_SUPERVISE t1,pqs_depts t2,pqs_user t3,pqs_user t4
where
t1.up_user is not null
and t1.create_time between #{startTime} and #{endTime}
and t1.up_user = #{userIndex}
and t1.depts=t2.depts_index
and t1.create_user=t3.user_index
and t1.modify_user=t4.user_index
<if test="type != 2">
and t1.type=#{type}
</if>
<if test="progress != 7">
and t1.progress=#{progress}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,131 @@
<?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.pqs9300.mapper.uploadFiles.UploadFilesMapper'>
<select id="getOverRunLogName" resultType="String" >
SELECT
NAME
FROM
THS_OVERRUNLOG
WHERE
SUP_INDEX = #{supIndex}
AND
LINE_INDEX = #{lineIndex}
AND
UPDATETIME = #{updateTime}
</select>
<update id="updateFeedbackUrl">
UPDATE
THS_OVERRUNLOG
SET
FEEDBACK = #{filePath}
WHERE
SUP_INDEX = #{supIndex}
AND
LINE_INDEX = #{lineIndex}
AND
UPDATETIME = #{updateTime}
</update>
<update id="updateTestReportUrl">
UPDATE
THS_OVERRUNLOG
SET
TESTREPORT = #{filePath}
WHERE
SUP_INDEX = #{supIndex}
AND
LINE_INDEX = #{lineIndex}
AND
UPDATETIME = #{updateTime}
</update>
<update id="updateReviseFeedbackUrl">
UPDATE
THS_OVERRUNLOG
SET
REVISEFEEDBACK = #{filePath}
WHERE
SUP_INDEX = #{supIndex}
AND
LINE_INDEX = #{lineIndex}
AND
UPDATETIME = #{updateTime}
</update>
<select id="getAllFileName" resultType="String" >
SELECT
a.NAME
FROM
THS_OVERRUNLOG a,THS_SUPERVISE b
WHERE
b.PROGRESS = #{stepCount}
AND
a.SUP_INDEX = b.SUP_INDEX
AND
b.SUP_INDEX = #{supIndex}
</select>
<update id="updateFilesFeedbackUrl">
UPDATE
THS_OVERRUNLOG
SET
FEEDBACK = #{filePath}
WHERE
NAME = #{fileName}
AND
SUP_INDEX = #{supIndex}
</update>
<update id="updateFilesTestReportUrl">
UPDATE
THS_OVERRUNLOG
SET
TESTREPORT = #{filePath}
WHERE
NAME = #{fileName}
AND
SUP_INDEX = #{supIndex}
</update>
<update id="updateFilesReviseFeedbackUrl">
UPDATE
THS_OVERRUNLOG
SET
REVISEFEEDBACK = #{filePath}
WHERE
NAME = #{fileName}
AND
SUP_INDEX = #{supIndex}
</update>
<update id="updateProgress">
UPDATE
THS_SUPERVISE
SET
PROGRESS = #{progress}
WHERE
SUP_INDEX = #{supIndex}
</update>
<select id="getOverRunLog" resultType="com.pqs9300.pojo.transaction.OverRunLog">
SELECT
SUP_INDEX,FEEDBACK,TESTREPORT,REVISEFEEDBACK
FROM
THS_OVERRUNLOG
WHERE
SUP_INDEX = #{supIndex}
</select>
<select id="getSuperviseType" resultType="Integer">
SELECT
TYPE
FROM
THS_SUPERVISE
WHERE
SUP_INDEX = #{supIndex}
</select>
</mapper>

View File

@@ -0,0 +1,120 @@
<?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}
AND t3.DevFlag=#{devStatus}
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}
AND t3.DevFlag=#{devStatus}
AND t3.DATATYPE in
<foreach collection="dataType" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,240 @@
<?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="com.njcn.pojo.user.Depts">
SELECT
t2.DIC_NAME area,
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="com.njcn.pojo.user.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.CUSTOM_DEPT <![CDATA[ <> ]]> 2
AND t1.STATE =1
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,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})
</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,29 @@
<?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"/>
<setting name="jdbcTypeForNull" value="NULL"/>
</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> -->
</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.pqs9300.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.pqs9300.mapper"/>
</bean>
<!--配置通用mapper -->
<bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.njcn.mapper,com.pqs9300.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="192.168.1.12" name="host" type="java.lang.String" />
<!-- <constructor-arg index="1" value="192.168.1.12" 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,183 @@
<?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="pqs9900"/>
<property name="httpOnly" value="true"/>
<!--cookie的有效时间 -->
<property name="maxAge" value="-1"/>
<property name="name" value="9300Cookie" />
</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>
<!-- 安全管理器 -->
<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="userShiroCacheManager" class="com.njcn.shiro.cache.impl.UserShiroCacheManager">
<property name="shiroCacheManager" ref="jedisShiroCacheManager"/>
</bean>
<bean id="jedisManager" class="com.njcn.utils.redis.JedisManager"/>
<!-- shiro 缓存实现对ShiroCacheManager我是采用redis的实现 -->
<bean id="jedisShiroCacheManager" class="com.njcn.shiro.cache.impl.JedisShiroCacheManager">
<property name="jedisManager" ref="jedisManager"/>
</bean>
<!-- 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
/=login,kickout,role[normal,wenchang]
/user/generateRSAKey=anon
/user/ssoRegister=anon
/druid/**=anon
/druid=anon
/auth/**=anon
/websocket/**=anon
/device/websocketon=anon
<!--用户相关-->
/**=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,118 @@
<?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 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>
<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>
<!-- 数据源配置,使用应用内的DBCP数据库连接池 ****end****-->
<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
<context:component-scan base-package="com.njcn,com.pqs9300">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
</beans>

View File

@@ -0,0 +1,45 @@
<?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.pqs9300.controller"/>
<!--处理静态资源的拦截问题-->
<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>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.njcn.interceptor.CSRFInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<!-- 上传文件的处理器 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 设置默认编码 解决了上传文件名乱码的问题 -->
<property name="defaultEncoding" value="utf-8"></property>
<!-- 上传图片最大大小5M -->
<property name="maxUploadSize" value="5242440"></property>
</bean>
</beans>