‘liusuyi’
2023-06-29 0362c0c8502a81fc974afb8d2aff85d9efd7bbb1
ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
@@ -63,6 +63,7 @@
            <if test="createTime != null">create_time,</if>
            <if test="userId != null">user_id,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="guideFlag != null">guide_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
@@ -77,6 +78,7 @@
            <if test="createTime != null">#{createTime},</if>
            <if test="userId != null">#{userId},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="guideFlag != null">#{guideFlag},</if>
        </trim>
    </insert>
@@ -94,6 +96,7 @@
            <if test="createTime != null">create_time = #{createTime},</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>
        </trim>
        where id = #{id}
    </update>
@@ -140,4 +143,28 @@
        WHERE aar.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE
          and aar.alarm_type = #{alarmType}
    </select>
    <select id="getCameraByRadar" resultType="String">
        select ac.id
        from ard_equip_radar aer
                 INNER JOIN ard_towers at
        on aer.tower_id= at.id
            INNER JOIN ard_cameras ac on aer.tower_id=ac.tower_id
    </select>
    <select id="getArdAlarmRadarWithGuide" resultMap="ArdAlarmRadarResult">
        select *
        from ard_alarm_radar
        where create_time > current_timestamp - interval '5' minute
          and guide_flag = #{guideFlag}
          and alarm_type =#{alarmType}
          and name = #{name}
        ORDER BY create_time desc  limit 1
    </select>
    <select id="getArdAlarmRadarWithNotGuide" resultType="Integer">
        select count(*)
        from ard_alarm_radar
        where create_time >= #{guideTime}
          and guide_flag = #{ardAlarmRadar.guideFlag}
          and alarm_type =#{ardAlarmRadar.alarmType}
          and name = #{ardAlarmRadar.name}
    </select>
</mapper>