|
|
@ -4,13 +4,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
<sql id="commonGroupSql"> |
|
|
|
<sql id="commonGroupSql"> |
|
|
|
<if test="timeType != null and timeType != '' and timeType == 'month'" > |
|
|
|
<if test="timeType != null and timeType != '' and timeType == 'month'" > |
|
|
|
,month(cur_time) |
|
|
|
,EXTRACT(MONTH FROM cur_time) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
<if test="timeType != null and timeType != '' and timeType == 'day'" > |
|
|
|
<if test="timeType != null and timeType != '' and timeType == 'day'" > |
|
|
|
,month(cur_time),day(cur_time) |
|
|
|
,EXTRACT(MONTH FROM cur_time),EXTRACT(DAY FROM cur_time) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
<if test="timeType != null and timeType != '' and timeType == 'hour'" > |
|
|
|
<if test="timeType != null and timeType != '' and timeType == 'hour'" > |
|
|
|
,month(cur_time),day(cur_time),datepart(hour, cur_time) |
|
|
|
,EXTRACT(MONTH FROM cur_time),EXTRACT(DAY FROM cur_time),EXTRACT(HOUR FROM cur_time) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
</sql> |
|
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
@ -87,7 +87,8 @@ |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${lastTableName} dh |
|
|
|
FROM ${lastTableName} dh |
|
|
|
WHERE cur_time >= #{yoyStartTime} AND cur_time <= #{yoyEndTime} |
|
|
|
WHERE cur_time >= #{yoyStartTime}::timestamp |
|
|
|
|
|
|
|
AND cur_time <= #{yoyEndTime}::timestamp |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -100,6 +101,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
@ -119,7 +123,8 @@ |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${curTableName} dh |
|
|
|
FROM ${curTableName} dh |
|
|
|
WHERE cur_time >= #{startTime} AND cur_time <= #{endTime} |
|
|
|
WHERE cur_time >= #{startTime}::timestamp |
|
|
|
|
|
|
|
AND cur_time <= #{endTime}::timestamp |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -132,6 +137,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
@ -151,7 +159,7 @@ |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${lastTableName} dh |
|
|
|
FROM ${lastTableName} dh |
|
|
|
WHERE cur_time >= #{startTime} AND cur_time <= #{endTime} |
|
|
|
WHERE cur_time >= #{startTime}::timestamp AND cur_time <= #{endTime}::timestamp |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -164,6 +172,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
@ -183,7 +194,7 @@ |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
EXTRACT(YEAR FROM cur_time) AS yearStr |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${curTableName} dh |
|
|
|
FROM ${curTableName} dh |
|
|
|
WHERE cur_time >= #{startTime} AND cur_time <= #{endTime} |
|
|
|
WHERE cur_time >= #{startTime}::timestamp AND cur_time <= #{endTime}::timestamp |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -196,6 +207,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
|
GROUP BY device_type, TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
@ -216,16 +230,15 @@ |
|
|
|
ELSE '同期无数据' |
|
|
|
ELSE '同期无数据' |
|
|
|
END AS yoy |
|
|
|
END AS yoy |
|
|
|
FROM ( |
|
|
|
FROM ( |
|
|
|
-- 子查询 a(去年同期数据) |
|
|
|
|
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
SUM(calc_value) AS sumValue, |
|
|
|
SUM(calc_value) AS sumValue, |
|
|
|
device_type AS deviceType, |
|
|
|
device_type AS deviceType, |
|
|
|
SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}) AS timeStr, <!--- 替换 CONVERT --> |
|
|
|
SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}) AS timeStr, |
|
|
|
EXTRACT(YEAR FROM cur_time)::INTEGER AS yearStr <!--- 替换 YEAR() --> |
|
|
|
EXTRACT(YEAR FROM cur_time)::INTEGER AS yearStr |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${yoyLastTableName} dh |
|
|
|
FROM ${yoyLastTableName} dh |
|
|
|
WHERE |
|
|
|
WHERE |
|
|
|
cur_time >= #{yoyStartTime} AND cur_time <= #{yoyEndTime} |
|
|
|
cur_time >= #{yoyStartTime}::timestamp AND cur_time <= #{yoyEndTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -236,11 +249,14 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
GROUP BY |
|
|
|
GROUP BY |
|
|
|
device_type, |
|
|
|
device_type, |
|
|
|
SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), <!--- 动态截取时间 --> |
|
|
|
SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), |
|
|
|
EXTRACT(YEAR FROM cur_time) <!--- 替换 YEAR() --> |
|
|
|
EXTRACT(YEAR FROM cur_time) |
|
|
|
<include refid="commonGroupSql" /> |
|
|
|
<include refid="commonGroupSql" /> |
|
|
|
UNION ALL |
|
|
|
UNION ALL |
|
|
|
SELECT |
|
|
|
SELECT |
|
|
@ -251,7 +267,7 @@ |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${yoyCurTableName} dh |
|
|
|
FROM ${yoyCurTableName} dh |
|
|
|
WHERE |
|
|
|
WHERE |
|
|
|
cur_time >= #{yoyStartTime} AND cur_time <= #{yoyEndTime} |
|
|
|
cur_time >= #{yoyStartTime}::timestamp AND cur_time <= #{yoyEndTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -262,6 +278,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
GROUP BY |
|
|
|
GROUP BY |
|
|
|
device_type, |
|
|
|
device_type, |
|
|
@ -269,8 +288,7 @@ |
|
|
|
EXTRACT(YEAR FROM cur_time) |
|
|
|
EXTRACT(YEAR FROM cur_time) |
|
|
|
<include refid="commonGroupSql" /> |
|
|
|
<include refid="commonGroupSql" /> |
|
|
|
) a |
|
|
|
) a |
|
|
|
RIGHT JOIN ( <!--- 右连接语法保持不变 --> |
|
|
|
RIGHT JOIN ( |
|
|
|
-- 子查询 b(当前期数据) |
|
|
|
|
|
|
|
SELECT |
|
|
|
SELECT |
|
|
|
SUM(calc_value) AS sumValue, |
|
|
|
SUM(calc_value) AS sumValue, |
|
|
|
device_type AS deviceType, |
|
|
|
device_type AS deviceType, |
|
|
@ -279,7 +297,7 @@ |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${lastTableName} dh |
|
|
|
FROM ${lastTableName} dh |
|
|
|
WHERE |
|
|
|
WHERE |
|
|
|
cur_time >= #{startTime} AND cur_time <= #{endTime} |
|
|
|
cur_time >= #{startTime}::timestamp AND cur_time <= #{endTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -290,6 +308,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
GROUP BY |
|
|
|
GROUP BY |
|
|
|
device_type, |
|
|
|
device_type, |
|
|
@ -305,7 +326,7 @@ |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
<include refid="commonSelectSql" /> |
|
|
|
FROM ${curTableName} dh |
|
|
|
FROM ${curTableName} dh |
|
|
|
WHERE |
|
|
|
WHERE |
|
|
|
cur_time >= #{startTime} AND cur_time <= #{endTime} |
|
|
|
cur_time >= #{startTime}::timestamp AND cur_time <= #{endTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -316,13 +337,16 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
GROUP BY |
|
|
|
GROUP BY |
|
|
|
device_type, |
|
|
|
device_type, |
|
|
|
SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), |
|
|
|
SUBSTRING(TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS') FROM 1 FOR ${len}), |
|
|
|
EXTRACT(YEAR FROM cur_time) |
|
|
|
EXTRACT(YEAR FROM cur_time) |
|
|
|
<include refid="commonGroupSql" /> |
|
|
|
<include refid="commonGroupSql" /> |
|
|
|
) b ON a.yearStr + 1 = b.yearStr <!--- 假设 yearStr 已转为整数 --> |
|
|
|
) b ON a.yearStr + 1 = b.yearStr |
|
|
|
<include refid="commonYOYWhereSql"/> |
|
|
|
<include refid="commonYOYWhereSql"/> |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
@ -351,7 +375,7 @@ |
|
|
|
,EXTRACT(MONTH FROM cur_time) AS monthStr |
|
|
|
,EXTRACT(MONTH FROM cur_time) AS monthStr |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
FROM ${tableName} dh |
|
|
|
FROM ${tableName} dh |
|
|
|
WHERE cur_time >= #{startTime} AND cur_time <= #{endTime} |
|
|
|
WHERE cur_time >= #{startTime}::timestamp AND cur_time <= #{endTime}::timestamp |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -364,6 +388,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
GROUP BY TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
|
GROUP BY TO_CHAR(cur_time, 'YYYY-MM-DD HH24:MI:SS'), EXTRACT(YEAR FROM cur_time) |
|
|
@ -386,7 +413,7 @@ |
|
|
|
,EXTRACT(MONTH FROM cur_time) AS monthStr |
|
|
|
,EXTRACT(MONTH FROM cur_time) AS monthStr |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
FROM ${tableName} dh |
|
|
|
FROM ${tableName} dh |
|
|
|
WHERE cur_time >= #{momStartTime} AND cur_time <= #{momEndTime} |
|
|
|
WHERE cur_time >= #{momStartTime}::timestamp AND cur_time <= #{momEndTime}::timestamp |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
AND calc_value IS NOT NULL |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
<if test='paramType!= null and paramType!= "" and paramType!= "system" '> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -399,6 +426,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
GROUP BY EXTRACT(YEAR FROM cur_time) |
|
|
|
GROUP BY EXTRACT(YEAR FROM cur_time) |
|
|
@ -443,8 +473,8 @@ |
|
|
|
from |
|
|
|
from |
|
|
|
${tableName} dh |
|
|
|
${tableName} dh |
|
|
|
where |
|
|
|
where |
|
|
|
cur_time >= #{startTime} |
|
|
|
cur_time >= #{startTime}::timestamp |
|
|
|
and cur_time <= #{endTime} |
|
|
|
and cur_time <= #{endTime}::timestamp |
|
|
|
and calc_value is not null |
|
|
|
and calc_value is not null |
|
|
|
<if test="paramType != null and paramType != '' and paramType != 'system'"> |
|
|
|
<if test="paramType != null and paramType != '' and paramType != 'system'"> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -457,6 +487,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
group by |
|
|
|
group by |
|
|
@ -480,8 +513,8 @@ |
|
|
|
from |
|
|
|
from |
|
|
|
${tableName} dh |
|
|
|
${tableName} dh |
|
|
|
where |
|
|
|
where |
|
|
|
cur_time >= #{momStartTime} |
|
|
|
cur_time >= #{momStartTime}::timestamp |
|
|
|
and cur_time <= #{momEndTime} |
|
|
|
and cur_time <= #{momEndTime}::timestamp |
|
|
|
and calc_value is not null |
|
|
|
and calc_value is not null |
|
|
|
<if test="paramType != null and paramType != '' and paramType != 'system'"> |
|
|
|
<if test="paramType != null and paramType != '' and paramType != 'system'"> |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
@ -494,6 +527,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
group by |
|
|
|
group by |
|
|
@ -528,10 +564,10 @@ |
|
|
|
extract(year from cur_time) as yearStr |
|
|
|
extract(year from cur_time) as yearStr |
|
|
|
<include refid="commonSelectSql"/> |
|
|
|
<include refid="commonSelectSql"/> |
|
|
|
from |
|
|
|
from |
|
|
|
${tableName1} |
|
|
|
${tableName1} dh |
|
|
|
where |
|
|
|
where |
|
|
|
cur_time >= #{startTime} |
|
|
|
cur_time >= #{startTime}::timestamp |
|
|
|
and cur_time <= #{endTime} |
|
|
|
and cur_time <= #{endTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -542,6 +578,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
group by |
|
|
|
group by |
|
|
|
substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), |
|
|
|
substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), |
|
|
@ -556,8 +595,8 @@ |
|
|
|
from |
|
|
|
from |
|
|
|
${tableName2} dh |
|
|
|
${tableName2} dh |
|
|
|
where |
|
|
|
where |
|
|
|
cur_time >= #{startTime} |
|
|
|
cur_time >= #{startTime}::timestamp |
|
|
|
and cur_time <= #{endTime} |
|
|
|
and cur_time <= #{endTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -568,6 +607,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
group by |
|
|
|
group by |
|
|
|
substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), |
|
|
|
substring(to_char(cur_time, 'YYYY-MM-DD HH24:MI:SS') from 1 for ${len}), |
|
|
@ -581,11 +623,24 @@ |
|
|
|
extract(year from cur_time) as yearStr |
|
|
|
extract(year from cur_time) as yearStr |
|
|
|
<include refid="commonLastSelectSql"/> |
|
|
|
<include refid="commonLastSelectSql"/> |
|
|
|
from |
|
|
|
from |
|
|
|
${tableName1} |
|
|
|
${tableName1} dh |
|
|
|
where |
|
|
|
where |
|
|
|
cur_time >= #{momStartTime} |
|
|
|
cur_time >= #{momStartTime}::timestamp |
|
|
|
and cur_time <= #{momEndTime} |
|
|
|
and cur_time <= #{momEndTime}::timestamp |
|
|
|
and device_type = #{paramType} |
|
|
|
and dh.device_num in ( |
|
|
|
|
|
|
|
select |
|
|
|
|
|
|
|
cpm.mt_num |
|
|
|
|
|
|
|
from |
|
|
|
|
|
|
|
collection_params_manage cpm |
|
|
|
|
|
|
|
join device_ledger dl on |
|
|
|
|
|
|
|
cpm.device_ledger_id = dl.id |
|
|
|
|
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
|
|
|
|
and dl.device_type = #{paramType} |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
and cpm.grade = 40 ) |
|
|
|
group by |
|
|
|
group by |
|
|
|
extract(year from cur_time) |
|
|
|
extract(year from cur_time) |
|
|
|
<include refid="commonLastGroupSql"/> |
|
|
|
<include refid="commonLastGroupSql"/> |
|
|
@ -597,8 +652,8 @@ |
|
|
|
from |
|
|
|
from |
|
|
|
${tableName2} dh |
|
|
|
${tableName2} dh |
|
|
|
where |
|
|
|
where |
|
|
|
cur_time >= #{momStartTime} |
|
|
|
cur_time >= #{momStartTime}::timestamp |
|
|
|
and cur_time <= #{momEndTime} |
|
|
|
and cur_time <= #{momEndTime}::timestamp |
|
|
|
and dh.device_num in ( |
|
|
|
and dh.device_num in ( |
|
|
|
select |
|
|
|
select |
|
|
|
cpm.mt_num |
|
|
|
cpm.mt_num |
|
|
@ -609,6 +664,9 @@ |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
<if test="paramType != null and paramType != '' "> |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
and dl.device_type = #{paramType} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != '' "> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
and cpm.grade = 40 ) |
|
|
|
and cpm.grade = 40 ) |
|
|
|
group by |
|
|
|
group by |
|
|
|
extract(year from cur_time) |
|
|
|
extract(year from cur_time) |
|
|
@ -702,6 +760,9 @@ |
|
|
|
where |
|
|
|
where |
|
|
|
dl.device_type = '5' |
|
|
|
dl.device_type = '5' |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != ''"> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
group by |
|
|
|
group by |
|
|
|
cpm.mt_type |
|
|
|
cpm.mt_type |
|
|
|
) |
|
|
|
) |
|
|
@ -747,6 +808,9 @@ |
|
|
|
where |
|
|
|
where |
|
|
|
dl.device_type = '5' |
|
|
|
dl.device_type = '5' |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != ''"> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
group by |
|
|
|
group by |
|
|
|
cpm.mt_type |
|
|
|
cpm.mt_type |
|
|
|
) |
|
|
|
) |
|
|
@ -945,6 +1009,9 @@ |
|
|
|
where |
|
|
|
where |
|
|
|
dl.device_type = '5' |
|
|
|
dl.device_type = '5' |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != ''"> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
group by |
|
|
|
group by |
|
|
|
cpm.mt_type |
|
|
|
cpm.mt_type |
|
|
|
) |
|
|
|
) |
|
|
@ -972,6 +1039,9 @@ |
|
|
|
where |
|
|
|
where |
|
|
|
dl.device_type = '5' |
|
|
|
dl.device_type = '5' |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
and cpm.terminal_device_type = #{deviceType} |
|
|
|
|
|
|
|
<if test="systemType != null and systemType != ''"> |
|
|
|
|
|
|
|
and cpm.system_type = #{systemType} |
|
|
|
|
|
|
|
</if> |
|
|
|
group by |
|
|
|
group by |
|
|
|
cpm.mt_type |
|
|
|
cpm.mt_type |
|
|
|
) |
|
|
|
) |
|
|
|