| | |
| | | |
| | | |
| | | <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 ( |
| | | <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::text like CONCAT('%', #{param2.droneName}::text, '%') |
| | | OR dar.drone_name::text LIKE CONCAT('%', #{param2.droneName}::text, '%') |
| | | </if> |
| | | <if test="param2.droneSerialNo != null and param2.droneSerialNo != ''"> |
| | | or dar.drone_serial_no::text like CONCAT('%', #{param2.droneSerialNo}::text, '%') |
| | | OR dar.drone_serial_no::text LIKE CONCAT('%', #{param2.droneSerialNo}::text, '%') |
| | | </if> |
| | | ) |
| | | </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}::timestamp AND #{param2.endTime}::timestamp |
| | | 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::text = #{param2.deviceType}::text |
| | | AND dar.device_type::text = #{param2.deviceType}::text |
| | | </if> |
| | | |
| | | <if test="param2.areaName != null and param2.areaName != ''"> |
| | | and dar.area_name::text like CONCAT('%', #{param2.areaName}::text, '%') |
| | | AND dar.area_name::text LIKE CONCAT('%', #{param2.areaName}::text, '%') |
| | | </if> |
| | | </where> |
| | | order by favorited desc, dar.alarm_time desc |
| | | ORDER BY favorited DESC, dar.alarm_time DESC |
| | | </select> |
| | | |
| | | |