|  |  | 
 |  |  | public interface DeviceAlarmMapper { | 
 |  |  |  | 
 |  |  |     @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " + | 
 |  |  |             "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')") | 
 |  |  |             "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})") | 
 |  |  |     int add(DeviceAlarm alarm); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Select(value = {" <script>" + | 
 |  |  |             " SELECT * FROM device_alarm " + | 
 |  |  |             " WHERE 1=1 " + | 
 |  |  |             " <if test=\"deviceId != null\" >  AND deviceId = '${deviceId}'</if>" + | 
 |  |  |             " <if test=\"alarmPriority != null\" >  AND alarmPriority = '${alarmPriority}' </if>" + | 
 |  |  |             " <if test=\"alarmMethod != null\" >  AND alarmMethod = '${alarmMethod}' </if>" + | 
 |  |  |             " <if test=\"alarmType != null\" >  AND alarmType = '${alarmType}' </if>" + | 
 |  |  |             " <if test=\"startTime != null\" >  AND alarmTime >= '${startTime}' </if>" + | 
 |  |  |             " <if test=\"endTime != null\" >  AND alarmTime <= '${endTime}' </if>" + | 
 |  |  |             " <if test=\"deviceId != null\" >  AND deviceId = #{deviceId}</if>" + | 
 |  |  |             " <if test=\"alarmPriority != null\" >  AND alarmPriority = #{alarmPriority} </if>" + | 
 |  |  |             " <if test=\"alarmMethod != null\" >  AND alarmMethod = #{alarmMethod} </if>" + | 
 |  |  |             " <if test=\"alarmType != null\" >  AND alarmType = #{alarmType} </if>" + | 
 |  |  |             " <if test=\"startTime != null\" >  AND alarmTime >= #{startTime} </if>" + | 
 |  |  |             " <if test=\"endTime != null\" >  AND alarmTime <= #{endTime} </if>" + | 
 |  |  |             " ORDER BY alarmTime ASC " + | 
 |  |  |             " </script>"}) | 
 |  |  |     List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod, | 
 |  |  | 
 |  |  |     @Delete(" <script>" + | 
 |  |  |             "DELETE FROM device_alarm WHERE 1=1 " + | 
 |  |  |             " <if test=\"deviceIdList != null and id == null \" > AND deviceId in " + | 
 |  |  |             "<foreach collection='deviceIdList'  item='item'  open='(' separator=',' close=')' > '${item}'</foreach>" + | 
 |  |  |             "<foreach collection='deviceIdList'  item='item'  open='(' separator=',' close=')' > #{item}</foreach>" + | 
 |  |  |             "</if>" + | 
 |  |  |             " <if test=\"time != null and id == null \" > AND alarmTime <= '${time}'</if>" + | 
 |  |  |             " <if test=\"id != null\" > AND id = ${id}</if>" + | 
 |  |  |             " <if test=\"time != null and id == null \" > AND alarmTime <= #{time}</if>" + | 
 |  |  |             " <if test=\"id != null\" > AND id = #{id}</if>" + | 
 |  |  |             " </script>" | 
 |  |  |             ) | 
 |  |  |     int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time); |