From 4f6290bb416e17e692eafcb5bb40ee15af5148fe Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期一, 12 八月 2024 14:20:55 +0800
Subject: [PATCH] 海康接口重写
---
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index be8a21a..33e3d5f 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -86,6 +86,7 @@
#{id}
</foreach>
</select>
+
<select id="selectTMonitorList" resultType="com.ycl.platform.domain.vo.TMonitorVO">
select m.id, m.serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude,
camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working,
@@ -250,7 +251,11 @@
<delete id="deleteTMonitorById" parameterType="Long">
delete
from t_monitor
- where id = #{id}
+ <where>
+ <if test="id !=null">
+ id = #{id}
+ </if>
+ </where>
</delete>
<delete id="deleteTMonitorByIds" parameterType="String">
@@ -336,7 +341,7 @@
t_monitor m
LEFT JOIN t_yw_point p ON m.serial_number = p.serial_number
LEFT JOIN t_yw_unit u ON p.unit_id = u.id
- LEFT JOIN t_work_order w ON p.id = w.point_id
+ LEFT JOIN t_work_order w ON w.serial_number = p.serial_number
WHERE u.id = #{unitId} AND MONTH(w.create_time) IS NOT NULL
<if test="dateRange != null and dateRange.size > 0">
AND DATE_FORMAT(w.create_time, '%Y-%m') BETWEEN #{dateRange[0]} AND #{dateRange[1]}
@@ -345,4 +350,98 @@
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