| | |
| | | <result property="longitude" column="longitude" /> |
| | | <result property="latitude" column="latitude" /> |
| | | <result property="altitude" column="altitude" /> |
| | | <result property="recordUrl" column="record_url" /> |
| | | <result property="viewTime" column="view_time" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectArdAlarmTubeVo"> |
| | | select id, host, tube_id, tube_name, tube_type, pipe_diameter, color, position, type, alarm_type, alarm_time, watcher, create_time, longitude, latitude, altitude, view_time from ard_alarm_tube |
| | | select id, host, tube_id, tube_name, tube_type, pipe_diameter, color, position, type, alarm_type, alarm_time, watcher, create_time, longitude, latitude, altitude, record_url, view_time from ard_alarm_tube |
| | | </sql> |
| | | |
| | | <select id="selectArdAlarmTubeList" parameterType="ArdAlarmTube" resultMap="ArdAlarmTubeResult"> |
| | |
| | | <if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if> |
| | | <if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if> |
| | | <if test="altitude != null and altitude != ''"> and altitude = #{altitude}</if> |
| | | <if test="recordUrl != null and recordUrl != ''"> and record_url = #{recordUrl}</if> |
| | | <if test="viewTime != null "> and view_time = #{viewTime}</if> |
| | | </where> |
| | | </select> |
| | |
| | | <if test="longitude != null">longitude,</if> |
| | | <if test="latitude != null">latitude,</if> |
| | | <if test="altitude != null">altitude,</if> |
| | | <if test="recordUrl != null">record_url,</if> |
| | | <if test="viewTime != null">view_time,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="longitude != null">#{longitude},</if> |
| | | <if test="latitude != null">#{latitude},</if> |
| | | <if test="altitude != null">#{altitude},</if> |
| | | <if test="recordUrl != null">#{recordUrl},</if> |
| | | <if test="viewTime != null">#{viewTime},</if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <if test="longitude != null">longitude = #{longitude},</if> |
| | | <if test="latitude != null">latitude = #{latitude},</if> |
| | | <if test="altitude != null">altitude = #{altitude},</if> |
| | | <if test="recordUrl != null">record_url = #{recordUrl},</if> |
| | | <if test="viewTime != null">view_time = #{viewTime},</if> |
| | | </trim> |
| | | where id = #{id} |
| | |
| | | aat.longitude, |
| | | aat.latitude, |
| | | aat.altitude, |
| | | aat.record_url, |
| | | ROW_NUMBER() OVER ( PARTITION BY aat.tube_id ORDER BY aat.alarm_time DESC ) AS rn, |
| | | COUNT(CASE WHEN aat.view_time IS NULL THEN 1 END) OVER ( PARTITION BY aat.tube_id ) AS COUNT, |
| | | COUNT ( aat.alarm_time ) OVER ( PARTITION BY tube_id ) AS total |
| | |
| | | ard_alarm_tube aat |
| | | WHERE |
| | | aat.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE ) |
| | | order by aat.alarm_time desc |
| | | ) T |
| | | WHERE T.rn = 1 |
| | | </select> |
| | | <select id="selectCountByStartTime" resultType="Integer"> |
| | | SELECT COUNT(DISTINCT aat.tube_id) |
| | | FROM ard_alarm_tube aat |
| | | WHERE aat.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE |
| | | </select> |
| | | <update id="updateViewTimeByTubeId" parameterType="String"> |
| | | update ard_alarm_tube |
| | | set view_time=#{viewTime} |