|  |  |  | 
|---|
|  |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
|---|
|  |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.ruoyi.alarm.stealAlarm.mapper.ArdAlarmStealelecMapper"> | 
|---|
|  |  |  | <mapper namespace="com.ruoyi.alarm.steal.mapper.ArdAlarmStealelecMapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="ArdAlarmStealelec"> | 
|---|
|  |  |  | <id column="id" property="id"/> | 
|---|
|  |  |  | <result column="name" property="name"/> | 
|---|
|  |  |  | 
|---|
|  |  |  | <result column="dept_id" property="deptId"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | id, name, describe, catalog_text, description, start_time, end_time,view_time,longitude,latitude,create_by,create_time,user_id,dept_id | 
|---|
|  |  |  | id | 
|---|
|  |  |  | , name, describe, catalog_text, description, start_time, end_time,view_time,longitude,latitude,altitude,create_by,create_time,user_id,dept_id | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectArdAlarmStealelecList" parameterType="ArdAlarmStealelec" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List"/> | 
|---|
|  |  |  | from ard_alarm_stealelec | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 
|---|
|  |  |  | AND start_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> | 
|---|
|  |  |  | AND start_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | order by start_time desc | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List"/> | 
|---|
|  |  |  | 
|---|
|  |  |  | ORDER BY aas.start_time DESC LIMIT 50 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="selectCountByStartTime" resultType="Integer"> | 
|---|
|  |  |  | select count(DISTINCT aas."describe") from ard_alarm_stealelec aas where aas.start_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE ) | 
|---|
|  |  |  | select count(DISTINCT aas."describe") | 
|---|
|  |  |  | from ard_alarm_stealelec aas | 
|---|
|  |  |  | where aas.start_time >= (CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE) | 
|---|
|  |  |  | and aas.view_time is null | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <update id="updateViewTimeByDescribe" parameterType="String"> | 
|---|
|  |  |  | update ard_alarm_stealelec | 
|---|
|  |  |  | 
|---|
|  |  |  | and start_time<=#{alarmTime} | 
|---|
|  |  |  | and view_time is null | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <insert id="insert" parameterType="ArdAlarmStealelec"> | 
|---|
|  |  |  | <update id="updateArdAlarmStealelec" parameterType="ArdAlarmStealelec"> | 
|---|
|  |  |  | update ard_alarm_stealelec | 
|---|
|  |  |  | <trim prefix="SET" suffixOverrides=","> | 
|---|
|  |  |  | <if test="name != null">name = #{name},</if> | 
|---|
|  |  |  | <if test="describe != null">describe = #{describe},</if> | 
|---|
|  |  |  | <if test="catalogText != null">catalog_text = #{catalogText},</if> | 
|---|
|  |  |  | <if test="description != null">description = #{description},</if> | 
|---|
|  |  |  | <if test="startTime != null">start_time = #{startTime},</if> | 
|---|
|  |  |  | <if test="endTime != null">end_time = #{endTime},</if> | 
|---|
|  |  |  | <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} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <insert id="insertArdAlarmStealelec" parameterType="ArdAlarmStealelec"> | 
|---|
|  |  |  | insert into ard_alarm_stealelec(<include refid="Base_Column_List"/>) | 
|---|
|  |  |  | values (#{id}, #{name},#{describe},#{catalogText},#{description}, #{startTime}, #{endTime}, | 
|---|
|  |  |  | #{viewTime},#{longitude},#{latitude},#{createBy},#{createTime},#{userId},#{deptId}) | 
|---|
|  |  |  | #{viewTime},#{longitude},#{latitude},#{altitude},#{createBy},#{createTime},#{userId},#{deptId}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | </mapper> | 
|---|