| | |
| | | |
| | | |
| | | <select id="selectFwDroneAlarmRecordPage" resultType="org.sxkj.fw.record.vo.FwDroneAlarmRecordVO"> |
| | | select |
| | | SELECT |
| | | dar.*, |
| | | d.device_name, |
| | | d.status deviceStatus, |
| | | d.status AS deviceStatus, |
| | | d.final_outbound_area, |
| | | /* 1=已关注,0=未关注 */ |
| | | EXISTS ( |
| | | SELECT 1 FROM ja_fw_alarm_favorite f |
| | | WHERE f.alarm_record_id::text = dar.id::text |
| | | AND f.user_id = #{param2.currentUserId}::bigint |
| | | AND f.is_deleted = 0 |
| | | ) AS favorited |
| | | from |
| | | FROM |
| | | ja_fw_drone_alarm_record dar |
| | | left join |
| | | ja_fw_device d on dar.device_id::text = d.id::text |
| | | LEFT JOIN |
| | | ja_fw_device d ON dar.device_id::text = d.id::text |
| | | <where> |
| | | dar.is_deleted = 0 |
| | | and d.is_enabled = 1 |
| | | |
| | | AND d.is_enabled = 1 |
| | | <if test="param2.regionCode != null and param2.regionCode != ''"> |
| | | and (d.final_outbound_area_code like CONCAT(#{param2.regionCode}, '%') |
| | | AND ( |
| | | d.final_outbound_area_code LIKE CONCAT(#{param2.regionCode}, '%') |
| | | <if test="param2.currentDeptId != null and param2.currentDeptId != '' "> |
| | | or dar.device_id::text in ( |
| | | OR dar.device_id::text IN ( |
| | | SELECT device_id::text FROM ja_fw_device_per_share |
| | | WHERE loan_to_dept_id = #{param2.currentDeptId}::bigint |
| | | AND is_deleted = 0 |
| | |
| | | </if> |
| | | |
| | | <if test="param2.deviceId != null and param2.deviceId != ''"> |
| | | and dar.device_id::text = #{param2.deviceId}::text |
| | | AND dar.device_id::text = #{param2.deviceId}::text |
| | | </if> |
| | | |
| | | <if test="param2.droneName != null and param2.droneName != '' or (param2.droneSerialNo != null and param2.droneSerialNo != '')"> |
| | | and ( |
| | | 1=2 <if test="param2.droneName != null and param2.droneName != ''"> |
| | | or dar.drone_name like CONCAT('%', #{param2.droneName}, '%') |
| | | </if> |
| | | <if test="param2.droneSerialNo != null and param2.droneSerialNo != ''"> |
| | | or dar.drone_serial_no like CONCAT('%', #{param2.droneSerialNo}, '%') |
| | | </if> |
| | | <if test="param2.droneName != null and param2.droneName != ''"> |
| | | AND ( dar.drone_name::text LIKE CONCAT('%', #{param2.droneName}::text, '%') |
| | | or dar.drone_serial_no::text LIKE CONCAT('%', #{param2.droneName}::text, '%') |
| | | ) |
| | | </if> |
| | | |
| | | <if test="param2.areaDivideId != null and param2.areaDivideId != ''"> |
| | | and dar.area_divide_id::text = #{param2.areaDivideId}::text |
| | | AND dar.area_divide_id::text = #{param2.areaDivideId}::text |
| | | </if> |
| | | |
| | | <if test="param2.defenseSceneId != null and param2.defenseSceneId != ''"> |
| | | and dar.defense_scene_id::text = #{param2.defenseSceneId}::text |
| | | AND dar.defense_scene_id::text = #{param2.defenseSceneId}::text |
| | | </if> |
| | | |
| | | <if test="param2.startTime != null and param2.startTime != '' and param2.endTime != null and param2.endTime != ''"> |
| | | and dar.alarm_time BETWEEN #{param2.startTime} AND #{param2.endTime} |
| | | AND dar.alarm_time BETWEEN #{param2.startTime}::timestamp AND #{param2.endTime}::timestamp |
| | | </if> |
| | | <if test="param2.deviceType != null and param2.deviceType != ''"> |
| | | AND dar.device_type = #{param2.deviceType} |
| | | </if> |
| | | <if test="param2.droneType != null and param2.droneType != ''"> |
| | | AND dar.drone_type = #{param2.droneType} |
| | | </if> |
| | | <if test="param2.alarmType != null and param2.alarmType != ''"> |
| | | and dar.alarm_type = #{param2.alarmType} |
| | | </if> |
| | | |
| | | <if test="param2.deviceType != null and param2.deviceType != ''"> |
| | | and dar.device_type::text = #{param2.deviceType}::text |
| | | <if test="param2.triggerReason != null and param2.triggerReason != ''"> |
| | | and dar.trigger_reason = #{param2.triggerReason} |
| | | </if> |
| | | <if test="param2.flightStatus != null and param2.flightStatus != ''"> |
| | | and dar.flight_status = #{param2.flightStatus} |
| | | </if> |
| | | <if test="param2.longitude != null and param2.longitude != ''"> |
| | | and dar.longitude = #{param2.longitude} |
| | | </if> |
| | | <if test="param2.latitude != null and param2.latitude != ''"> |
| | | and dar.latitude = #{param2.latitude} |
| | | </if> |
| | | <if test="param2.signalFreqMhz != null and param2.signalFreqMhz != ''"> |
| | | and dar.signal_freq_mhz = #{param2.signalFreqMhz} |
| | | </if> |
| | | <if test="param2.flightHeightM != null and param2.flightHeightM != ''"> |
| | | and dar.flight_height_m = #{param2.flightHeightM} |
| | | </if> |
| | | <if test="param2.flightSpeedMs != null and param2.flightSpeedMs != ''"> |
| | | and dar.flight_speed_ms = #{param2.flightSpeedMs} |
| | | </if> |
| | | <if test="param2.stayDuration != null and param2.stayDuration != ''"> |
| | | and dar.stay_duration = #{param2.stayDuration} |
| | | </if> |
| | | <if test="param2.counterWay != null and param2.counterWay != ''"> |
| | | and dar.counter_way = #{param2.counterWay} |
| | | </if> |
| | | |
| | | <if test="param2.areaName != null and param2.areaName != ''"> |
| | | and dar.area_name like CONCAT('%', #{param2.areaName}, '%') |
| | | AND dar.area_name::text LIKE CONCAT('%', #{param2.areaName}::text, '%') |
| | | </if> |
| | | ORDER BY favorited DESC, dar.alarm_time DESC |
| | | </where> |
| | | order by favorited desc, dar.alarm_time desc |
| | | |
| | | </select> |
| | | |
| | | |