From 2a0a87b0cc877ecc6fc2ffcff26ff0cbf26ff2ef Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 09 八月 2024 17:06:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 95 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index 62acb31..33e3d5f 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -346,7 +346,102 @@
<if test="dateRange != null and dateRange.size > 0">
AND DATE_FORMAT(w.create_time, '%Y-%m') BETWEEN #{dateRange[0]} AND #{dateRange[1]}
</if>
+ GROUP BY months
ORDER BY months
</select>
+ <select id="monitorTotal" resultType="com.ycl.platform.domain.vo.screen.MonitorTotalVO">
+ SELECT
+ '瑙嗛' as type,
+ COUNT(p1.id) AS totalNum,
+ COUNT(p2.id) AS errorNum,
+ COUNT(p1.id) - COUNT(p2.id) AS normalNum
+ FROM t_monitor
+ LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if>
+ LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if>
+ WHERE INSTR(camera_fun_type, 1)
+ <if test="deptId != null"> AND p1.dept_id = #{deptId} AND p2.dept_id = #{deptId} </if>
+ UNION ALL
+ SELECT
+ '杞﹁締' as type,
+ COUNT(p1.id) AS totalNum,
+ COUNT(p2.id) AS errorNum,
+ COUNT(p1.id) - COUNT(p2.id) AS normalNum
+ FROM t_monitor
+ LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if>
+ LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if>
+ WHERE INSTR(camera_fun_type, 2)
+ <if test="deptId != null"> AND p1.dept_id = #{deptId} AND p2.dept_id = #{deptId} </if>
+ UNION ALL
+ SELECT
+ '浜鸿劯' as type,
+ COUNT(p1.id) AS totalNum,
+ COUNT(p2.id) AS errorNum,
+ COUNT(p1.id) - COUNT(p2.id) AS normalNum
+ FROM t_monitor
+ LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if>
+ LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if>
+ WHERE INSTR(camera_fun_type, 3)
+ <if test="deptId != null"> AND p1.dept_id = #{deptId} AND p2.dept_id = #{deptId} </if>
+ </select>
+
+ <select id="monitorRate" resultType="com.ycl.platform.domain.vo.screen.MonitorRateVO">
+ SELECT
+ *
+ FROM
+ -- 浜鸿劯璁惧
+ (
+ SELECT
+ d.area,
+ IFNULL(ROUND((COUNT(m.id) - COUNT(m2.id)) / COUNT(m.id) * 100, 2), 0) AS faceRate,
+ COUNT(m.id) - COUNT(m2.id) AS faceNormalNum,
+ COUNT(m2.id) AS faceErrorNum
+ FROM
+ sys_dept d
+ LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 'province' </if>
+ LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if>
+ LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 1)
+ LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 1)
+ WHERE d.del_flag = 0 AND d.area IS NOT NULL
+ GROUP BY d.area, d.dept_id
+ ORDER BY d.dept_id
+ ) a
+ INNER JOIN
+ -- 杞﹁締璁惧
+ (
+ SELECT
+ d.area,
+ IFNULL(ROUND((COUNT(m.id) - COUNT(m2.id)) / COUNT(m.id) * 100, 2), 0) AS carRate,
+ COUNT(m.id) - COUNT(m2.id) AS carNormalNum,
+ COUNT(m2.id) AS carErrorNum
+ FROM
+ sys_dept d
+ LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 'province' </if>
+ LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if>
+ LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 2)
+ LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 2)
+ WHERE d.del_flag = 0 AND d.area IS NOT NULL
+ GROUP BY d.area, d.dept_id
+ ORDER BY d.dept_id
+ ) b ON a.area = b.area
+ INNER JOIN
+ -- 瑙嗛璁惧
+ (
+ SELECT
+ d.area,
+ IFNULL(ROUND((COUNT(m.id) - COUNT(m2.id)) / COUNT(m.id) * 100, 2), 0) AS videoRate,
+ COUNT(m.id) - COUNT(m2.id) AS videoNormalNum,
+ COUNT(m2.id) AS videoErrorNum
+ FROM
+ sys_dept d
+ LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 'province' </if>
+ LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if>
+ LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 3)
+ LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 3)
+ WHERE d.del_flag = 0 AND d.area IS NOT NULL
+ GROUP BY d.area, d.dept_id
+ ORDER BY d.dept_id
+ ) c ON a.area = c.area
+ </select>
+
</mapper>
--
Gitblit v1.8.0