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 | 174 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 112 insertions(+), 62 deletions(-) diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml index 5a1974b..475d5b3 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml @@ -105,7 +105,7 @@ camera_dept, hybm, lxbm,d.dept_id, d.dept_name from t_monitor m left join t_yw_point p on m.serial_number = p.serial_number left join sys_dept d on p.dept_id = d.dept_id - where m.serial_number in + where p.examine_status = 1 and m.serial_number in <foreach collection="list" separator="," item="id" open="(" close=")"> #{id} </foreach> @@ -121,14 +121,14 @@ <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, p.online as onState, civil_code, d.dept_id, d.dept_name, d.area, p.province_tag,p.dept_tag, - IF(COUNT(w.id) OVER() > 0, '鏄�', '鍚�') AS error, u.unit_name,p.recovery_time,p.reason,p.start_time,p.end_time,w.work_order_no + IF(COUNT(w.id) OVER() > 0, '鏄�', '鍚�') AS error, u.unit_name,p.recovery_time,p.reason,p.start_time,p.end_time, w.work_order_no 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 ( WITH cte AS ( SELECT *,row_number() OVER(PARTITION BY serial_number ORDER BY create_time DESC) rn FROM t_work_order - WHERE deleted = 0 AND status != 'AUDITING_SUCCESS' + WHERE deleted = 0 AND status = 'AUDITING_SUCCESS' ) SELECT * FROM cte WHERE rn=1 ) w on m.serial_number = w.serial_number and w.deleted = 0 left join t_yw_unit u on p.unit_id = u.id and u.deleted = 0 @@ -178,6 +178,32 @@ <if test="lxbm != null ">and lxbm = #{lxbm}</if> <!-- <if test="recovery != null ">and p.recovery = #{recovery}</if>--> ${params.dataScope} + </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> @@ -369,7 +395,8 @@ IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers, IFNULL(SUM(IF(p.online = -1, 1, 0)), 0) AS postsPercentage, IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS unknownNumbers, - IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage FROM t_monitor m + IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage + FROM t_monitor m left join t_yw_point p on m.serial_number = p.serial_number left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0 <where> @@ -385,12 +412,13 @@ </select> <select id="recoveryException" resultType="java.util.Map"> - SELECT count(*) AS totalPosts, - IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers, - IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS postsPercentage, - IFNULL(ROUND(SUM(IF(p.online = 1, 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage - FROM t_monitor t - LEFT JOIN t_yw_point p ON t.serial_number = p.serial_number + SELECT count(*) AS totalPosts, + IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers, + IFNULL(SUM(IF(p.online = -1, 1, 0)), 0) AS postsPercentage, + IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS unknownNumbers, + IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage + FROM t_monitor m + left join t_yw_point p on m.serial_number = p.serial_number left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0 <where> p.examine_status = 1 @@ -398,6 +426,9 @@ <if test="provinceTag!=null"> and p.province_tag = #{provinceTag} </if> + <if test="deptTag!=null"> + and p.dept_tag = #{deptTag} + </if> ${params.dataScope} </where> </select> @@ -560,53 +591,51 @@ </select> -<!-- <select id="assetManagement" resultMap="dyMap">--> -<!-- SELECT--> -<!-- tm.id,--> -<!-- tm.serial_number,--> -<!-- tm.name,--> -<!-- tm.site_type,--> -<!-- tm.mac_addr,--> -<!-- tm.ip,--> -<!-- tm.camera_fun_type,--> -<!-- tm.longitude,--> -<!-- tm.latitude,--> -<!-- tm.camera_capture_area,--> -<!-- tm.on_state,--> -<!-- tm.civil_code,--> -<!-- tm.integrated_device,--> -<!-- tm.camera_brand,--> -<!-- tm.address,--> -<!-- tm.net_working,--> -<!-- tm.public_security,--> -<!-- tm.installed_time,--> -<!-- tm.management_unit,--> -<!-- tm.mu_contact_info,--> -<!-- tm.storage_days,--> -<!-- tm.monitor_azimuth,--> -<!-- tm.scene_photo_addr,--> -<!-- tm.model,--> -<!-- tm.site_vulgo,--> -<!-- tm.camera_type,--> -<!-- tm.camera_light_type,--> -<!-- tm.encoded_format,--> -<!-- tm.camera_dept,--> -<!-- tm.hybm,--> -<!-- tm.lxbm,--> -<!-- 't_monitor' as tableName,--> -<!-- #{query.keyword} as keyword--> -<!-- FROM--> -<!-- t_monitor tm--> -<!-- INNER JOIN t_yw_point yp ON yp.serial_number = tm.serial_number--> -<!-- <where>--> -<!-- <if test="query.keyword != null and query.keyword != ''">--> -<!-- AND tm.name like concat('%', #{query.keyword}, '%')--> -<!-- </if>--> -<!-- <if test="query.startTIme != null and query.endTime != null">--> -<!-- AND yp.create_time between #{query.startTime} and #{query.endTime}--> -<!-- </if>--> -<!-- </where>--> -<!-- </select>--> + <select id="assetManagement" resultType="com.ycl.platform.domain.vo.TMonitorVO"> + SELECT + tm.id, + tm.serial_number, + tm.name, + tm.site_type, + tm.mac_addr, + tm.ip, + tm.camera_fun_type, + tm.longitude, + tm.latitude, + tm.camera_capture_area, + tm.on_state, + tm.civil_code, + tm.integrated_device, + tm.camera_brand, + tm.address, + tm.net_working, + tm.public_security, + tm.installed_time, + tm.management_unit, + tm.mu_contact_info, + tm.storage_days, + tm.monitor_azimuth, + tm.scene_photo_addr, + tm.model, + tm.site_vulgo, + tm.camera_type, + tm.camera_light_type, + tm.encoded_format, + tm.camera_dept, + tm.hybm, + tm.lxbm + FROM + t_monitor tm + INNER JOIN t_yw_point yp ON yp.serial_number = tm.serial_number + <where> + <if test="query.keyword != null and query.keyword != ''"> + AND tm.name like concat('%', #{query.keyword}, '%') + </if> + <if test="query.startTIme != null and query.endTime != null"> + AND yp.create_time between #{query.startTime} and #{query.endTime} + </if> + </where> + </select> <!-- <select id="getDyColumns" resultMap="dynamicColumnMap">--> <!-- SELECT--> @@ -680,18 +709,39 @@ from t_monitor m left join t_yw_point p on m.serial_number = p.serial_number left join sys_dept d on p.dept_id = d.dept_id - where p.online != 0 and p.examine_status = 1 + where p.online != 0 and p.examine_status = 1 </select> <update id="updateOnline"> <foreach collection="onlineList" item="online" separator=";"> UPDATE - t_yw_point + t_yw_point SET - online = #{online.online}, - update_time = #{online.updateTime} + online = #{online.online}, + 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 ) + EXISTS (SELECT 1 FROM t_monitor + 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