Files
system-jibei/pqs9000/src/main/resources/mybatis/mappers/report/GetICurrentMapper.xml
2024-04-01 09:20:31 +08:00

262 lines
17 KiB
XML

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