From 95f69d1183a56f5768e6d56d043b0c6e5a878bb5 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 04 十二月 2024 21:30:26 +0800
Subject: [PATCH] 空指针校验

---
 ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml |   55 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index 5a297d8..475d5b3 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -181,6 +181,32 @@
         </where>
     </select>
 
+    <select id="exportTMonitorList" resultType="com.ycl.platform.domain.excel.TMonitorExp">
+        select m.id, m.serial_number, name, ip, camera_fun_type,p.online as onState,
+        d.dept_name, p.id as pointId,p.province_tag,p.dept_tag,p.important_tag,p.important_command_image_tag,u.unit_name as managementUnit
+        from t_monitor m
+        left join t_yw_point p on m.serial_number = p.serial_number and p.deleted = 0
+        left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0
+        left join t_yw_unit u on p.unit_id = u.id and u.deleted = 0
+        <where>
+            p.examine_status = 1
+            <if test="serialNumber != null  and serialNumber != ''">and m.serial_number = #{serialNumber}</if>
+            <if test="name != null  and name != ''">
+                and (name like concat('%', #{name}, '%')
+                or m.ip like concat('%', #{name}, '%')
+                or m.serial_number like concat('%', #{name}, '%')
+                or u.unit_name like concat('%', #{name}, '%'))
+            </if>
+            <if test="provinceTag != null ">and p.province_tag = #{provinceTag}</if>
+            <if test="deptTag != null ">and p.dept_tag = #{deptTag}</if>
+            <if test="cameraFunType != null  and cameraFunType != ''">and camera_fun_type like concat('%',
+                #{cameraFunType}, '%')
+            </if>
+            <if test="onState != null ">and p.online = #{onState}</if>
+            <if test="civilCode != null  and civilCode != ''">and civil_code = #{civilCode}</if>
+        </where>
+    </select>
+
     <select id="selectMonitorVOList" 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,
@@ -695,14 +721,27 @@
             update_time = #{online.updateTime}
             WHERE
             EXISTS (SELECT 1 FROM t_monitor
-            <where>
-                ip = #{online.ip} AND t_monitor.serial_number = t_yw_point.serial_number
-                <if test="online.online!=null and online.online">
-                    and t_monitor.camera_fun_type = '2' or t_monitor.camera_fun_type = '3'
-                </if>
-            </where>
-            )
+            WHERE ip = #{online.ip}
+            AND t_monitor.serial_number = t_yw_point.serial_number )
         </foreach>
     </update>
-
+    <update id="batchUpdateOnline">
+            UPDATE
+            t_yw_point p
+            LEFT JOIN t_monitor m on p.serial_number = m.serial_number
+            SET
+            p.online = #{online},
+            p.update_time = #{date}
+            WHERE m.ip in
+            <foreach collection="ipList" open="(" close=")" separator="," item="ip">
+                #{ip}
+            </foreach>
+    </update>
+    <select id="selectCarOrFace" resultType="com.ycl.platform.domain.entity.TMonitor">
+        select m.*
+        from t_monitor m
+        left join t_yw_point p
+        on m.serial_number = p.serial_number
+        where (m.camera_fun_type = '2' or m.camera_fun_type = '3') and p.examine_status = 1
+    </select>
 </mapper>

--
Gitblit v1.8.0