From 73548e5d89a79ef1850c03dea162dcf727e2c0b1 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 20 九月 2024 09:32:57 +0800 Subject: [PATCH] 去重 --- ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityDetailMapper.xml | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityDetailMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityDetailMapper.xml index 56f3aef..13c0c67 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityDetailMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/ImageResourceSecurityDetailMapper.xml @@ -27,7 +27,8 @@ FROM t_image_resource_security_detail </sql> - <select id="selectImageResourceSecurityDetailList" resultType="com.ycl.platform.domain.entity.ImageResourceSecurityDetail"> + <select id="selectImageResourceSecurityDetailList" + resultType="com.ycl.platform.domain.entity.ImageResourceSecurityDetail"> select id, ip, a.dept_id, @@ -40,12 +41,14 @@ from t_image_resource_security_detail a LEFT JOIN sys_dept b ON a.dept_id = b.dept_id AND b.del_flag = 0 <where> - <if test="ip != null and ip != ''">and ip = #{ip}</if> - <if test="deptId != null ">and a.dept_id = #{deptId}</if> - <if test="alarmCategory != null and alarmCategory != ''">and alarm_category = #{alarmCategory}</if> - <if test="alarmLevel != null ">and alarm_level = #{alarmLevel}</if> - <if test="num != null ">and num = #{num}</if> - <if test="alarmTime != null ">and alarm_time = #{alarmTime}</if> + <if test="startTime!=null and endTime!=null"> + and a.alarm_time between #{startTime} and #{endTime} + </if> + <if test="keyword!=null and keyword!=''"> + and (b.dept_name like concat('%',#{keyword},'%') or + a.ip like concat('%',#{keyword},'%') + ) + </if> </where> </select> @@ -78,9 +81,11 @@ </insert> <insert id="saveBatch"> - INSERT INTO t_image_resource_security_detail (ip, dept_id, alarm_category, alarm_level, num, alarm_time, create_time) VALUES + INSERT INTO t_image_resource_security_detail (ip, dept_id, alarm_category, alarm_level, num, alarm_time, + create_time) VALUES <foreach collection="list" item="item" index="index" separator=","> - (#{item.ip}, #{item.deptId}, #{item.alarmCategory}, #{item.alarmLevel}, #{item.num}, #{item.alarmTime}, NOW()) + (#{item.ip}, #{item.deptId}, #{item.alarmCategory}, #{item.alarmLevel}, #{item.num}, #{item.alarmTime}, + NOW()) </foreach> </insert> -- Gitblit v1.8.0