|  |  | 
 |  |  | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | 
 |  |  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
 |  |  | <mapper namespace="com.ruoyi.alarm.radar.mapper.ArdAlarmRadarPumpMapper"> | 
 |  |  |      | 
 |  |  |  | 
 |  |  |     <resultMap type="ArdAlarmRadarPump" id="ArdAlarmRadarPumpResult"> | 
 |  |  |         <result property="id"    column="id"    /> | 
 |  |  |         <result property="name"    column="name"    /> | 
 |  |  | 
 |  |  |         <result property="alarmTime"    column="alarm_time"    /> | 
 |  |  |         <result property="longitude"    column="longitude"    /> | 
 |  |  |         <result property="latitude"    column="latitude"    /> | 
 |  |  |         <result property="recordUrl1"    column="record_url1"    /> | 
 |  |  |         <result property="recordUrl"    column="record_url"    /> | 
 |  |  |         <result property="viewTime"    column="view_time"    /> | 
 |  |  |         <result property="createBy"    column="create_by"    /> | 
 |  |  |         <result property="createTime"    column="create_time"    /> | 
 |  |  |         <result property="userId"    column="user_id"    /> | 
 |  |  |         <result property="deptId"    column="dept_id"    /> | 
 |  |  |         <result property="guideFlag"    column="guide_flag"    /> | 
 |  |  |         <result property="guideTime"    column="guide_time"    /> | 
 |  |  |     </resultMap> | 
 |  |  |  | 
 |  |  |     <sql id="selectArdAlarmRadarPumpVo"> | 
 |  |  |         select id, name, target_id, alarm_type, alarm_time, longitude, latitude, record_url1, view_time, create_by, create_time, user_id, dept_id, guide_flag from ard_alarm_radar_pump | 
 |  |  |         select id, name, target_id, alarm_type, alarm_time, longitude, latitude, record_url, view_time, create_by, create_time, user_id, dept_id, guide_time from ard_alarm_radar_pump | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  |     <select id="selectArdAlarmRadarPumpList" parameterType="ArdAlarmRadarPump" resultMap="ArdAlarmRadarPumpResult"> | 
 |  |  |         <include refid="selectArdAlarmRadarPumpVo"/> | 
 |  |  |         <where>   | 
 |  |  |         <where> | 
 |  |  |             <if test="name != null  and name != ''"> and name like '%'||#{name}||'%'</if> | 
 |  |  |             <if test="targetId != null  and targetId != ''"> and target_id = #{targetId}</if> | 
 |  |  |             <if test="alarmType != null  and alarmType != ''"> and alarm_type = #{alarmType}</if> | 
 |  |  |             <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if> | 
 |  |  |             <if test="longitude != null "> and longitude = #{longitude}</if> | 
 |  |  |             <if test="latitude != null "> and latitude = #{latitude}</if> | 
 |  |  |             <if test="recordUrl1 != null  and recordUrl1 != ''"> and record_url1 = #{recordUrl1}</if> | 
 |  |  |             <if test="recordUrl != null  and recordUrl != ''"> and record_url = #{recordUrl}</if> | 
 |  |  |             <if test="viewTime != null "> and view_time = #{viewTime}</if> | 
 |  |  |             <if test="userId != null  and userId != ''"> and user_id = #{userId}</if> | 
 |  |  |             <if test="deptId != null "> and dept_id = #{deptId}</if> | 
 |  |  |             <if test="guideFlag != null "> and guide_flag = #{guideFlag}</if> | 
 |  |  |             <if test="guideTime != null "> and guide_time = #{guideTime}</if> | 
 |  |  |             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 
 |  |  |                 AND alarm_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss') | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |                 AND alarm_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss') | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |         order by alarm_time desc | 
 |  |  |     </select> | 
 |  |  |      | 
 |  |  |  | 
 |  |  |     <select id="selectArdAlarmRadarPumpById" parameterType="String" resultMap="ArdAlarmRadarPumpResult"> | 
 |  |  |         <include refid="selectArdAlarmRadarPumpVo"/> | 
 |  |  |         where id = #{id} | 
 |  |  |     </select> | 
 |  |  |          | 
 |  |  |  | 
 |  |  |     <insert id="insertArdAlarmRadarPump" parameterType="ArdAlarmRadarPump"> | 
 |  |  |         insert into ard_alarm_radar_pump | 
 |  |  |         <trim prefix="(" suffix=")" suffixOverrides=","> | 
 |  |  | 
 |  |  |             <if test="alarmTime != null">alarm_time,</if> | 
 |  |  |             <if test="longitude != null">longitude,</if> | 
 |  |  |             <if test="latitude != null">latitude,</if> | 
 |  |  |             <if test="recordUrl1 != null">record_url1,</if> | 
 |  |  |             <if test="recordUrl != null">record_url,</if> | 
 |  |  |             <if test="viewTime != null">view_time,</if> | 
 |  |  |             <if test="createBy != null">create_by,</if> | 
 |  |  |             <if test="createTime != null">create_time,</if> | 
 |  |  |             <if test="updateTime != null">update_time,</if> | 
 |  |  |             <if test="userId != null">user_id,</if> | 
 |  |  |             <if test="deptId != null">dept_id,</if> | 
 |  |  |             <if test="guideFlag != null">guide_flag,</if> | 
 |  |  |             <if test="guideTime != null">guide_time,</if> | 
 |  |  |          </trim> | 
 |  |  |         <trim prefix="values (" suffix=")" suffixOverrides=","> | 
 |  |  |             <if test="id != null">#{id},</if> | 
 |  |  | 
 |  |  |             <if test="alarmTime != null">#{alarmTime},</if> | 
 |  |  |             <if test="longitude != null">#{longitude},</if> | 
 |  |  |             <if test="latitude != null">#{latitude},</if> | 
 |  |  |             <if test="recordUrl1 != null">#{recordUrl1},</if> | 
 |  |  |             <if test="recordUrl != null">#{recordUrl},</if> | 
 |  |  |             <if test="viewTime != null">#{viewTime},</if> | 
 |  |  |             <if test="createBy != null">#{createBy},</if> | 
 |  |  |             <if test="createTime != null">#{createTime},</if> | 
 |  |  |             <if test="updateTime != null">#{updateTime},</if> | 
 |  |  |             <if test="userId != null">#{userId},</if> | 
 |  |  |             <if test="deptId != null">#{deptId},</if> | 
 |  |  |             <if test="guideFlag != null">#{guideFlag},</if> | 
 |  |  |             <if test="guideTime != null">#{guideTime},</if> | 
 |  |  |          </trim> | 
 |  |  |     </insert> | 
 |  |  |  | 
 |  |  | 
 |  |  |             <if test="alarmTime != null">alarm_time = #{alarmTime},</if> | 
 |  |  |             <if test="longitude != null">longitude = #{longitude},</if> | 
 |  |  |             <if test="latitude != null">latitude = #{latitude},</if> | 
 |  |  |             <if test="recordUrl1 != null">record_url1 = #{recordUrl1},</if> | 
 |  |  |             <if test="recordUrl != null">record_url = #{recordUrl},</if> | 
 |  |  |             <if test="viewTime != null">view_time = #{viewTime},</if> | 
 |  |  |             <if test="createBy != null">create_by = #{createBy},</if> | 
 |  |  |             <if test="createTime != null">create_time = #{createTime},</if> | 
 |  |  |             <if test="updateTime != null">update_time = #{updateTime},</if> | 
 |  |  |             <if test="userId != null">user_id = #{userId},</if> | 
 |  |  |             <if test="deptId != null">dept_id = #{deptId},</if> | 
 |  |  |             <if test="guideFlag != null">guide_flag = #{guideFlag},</if> | 
 |  |  |             <if test="guideTime != null">guide_time = #{guideTime},</if> | 
 |  |  |         </trim> | 
 |  |  |         where id = #{id} | 
 |  |  |     </update> | 
 |  |  | 
 |  |  |     </delete> | 
 |  |  |  | 
 |  |  |     <delete id="deleteArdAlarmRadarPumpByIds" parameterType="String"> | 
 |  |  |         delete from ard_alarm_radar_pump where id in  | 
 |  |  |         delete from ard_alarm_radar_pump where id in | 
 |  |  |         <foreach item="id" collection="array" open="(" separator="," close=")"> | 
 |  |  |             #{id} | 
 |  |  |         </foreach> | 
 |  |  | 
 |  |  |           and alarm_time<=#{alarmTime} | 
 |  |  |           and view_time is null | 
 |  |  |     </update> | 
 |  |  | </mapper> | 
 |  |  |     <select id="selectArdAlarmRadarLastData" parameterType="String" resultMap="ArdAlarmRadarPumpResult"> | 
 |  |  |         select * from ard_alarm_radar_pump where name=#{name} order by update_time desc LIMIT 1 | 
 |  |  |     </select> | 
 |  |  |     <select id="pumpYear" resultType="com.ruoyi.statistical.vo.CountVo"> | 
 |  |  |         select to_char(alarm_time::DATE, 'MM') as date,count(id) | 
 |  |  |         from ard_alarm_radar_pump | 
 |  |  |         where alarm_time >= #{start} and  alarm_time <= #{end}  group by date order by date | 
 |  |  |     </select> | 
 |  |  |     <select id="pumpMonth" resultType="com.ruoyi.statistical.vo.CountVo"> | 
 |  |  |         select to_char(alarm_time::DATE, 'dd') as date,count(id) | 
 |  |  |         from ard_alarm_radar_pump | 
 |  |  |         where alarm_time >= #{start} and  alarm_time <= #{end}  group by date order by date | 
 |  |  |     </select> | 
 |  |  | </mapper> |