|  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.annotations.DynamicParameter; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.annotations.DynamicParameters; | 
|---|
|  |  |  | import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig; | 
|---|
|  |  |  | import com.ruoyi.alarm.config.service.IArdAlarmTypeConfigService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Log(title = "批量配置报警类型", businessType = BusinessType.INSERT) | 
|---|
|  |  |  | @PostMapping("/batchConfig") | 
|---|
|  |  |  | @ApiOperation("批量配置报警类型") | 
|---|
|  |  |  | @ApiOperationSupport(includeParameters = {"map.userId", "map.commands"}) | 
|---|
|  |  |  | public AjaxResult addBatch(@RequestBody Map<String,Object> map) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return AjaxResult.success(ardAlarmTypeConfigService.insertArdAlarmTypeConfig(map)); | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int insertArdAlarmTypeConfig(Map<String,Object> configInfo) { | 
|---|
|  |  |  | String userId =(String) configInfo.get("userId"); | 
|---|
|  |  |  | if(userId==null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ardAlarmTypeConfigMapper.deleteArdAlarmTypeConfigByCurrentUserId(userId); | 
|---|
|  |  |  | List<Integer> commands=(List<Integer>) configInfo.get("commands"); | 
|---|
|  |  |  | if(commands==null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(commands.size()==0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.ruoyi.common.annotation.Anonymous; | 
|---|
|  |  |  | import com.ruoyi.common.core.domain.AjaxResult; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.springframework.beans.propertyeditors.CustomDateEditor; | 
|---|
|  |  |  | import org.springframework.web.bind.WebDataBinder; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | Map<String, Integer> stringIntegerMap = globalAlarmService.selectAlarmLogsCount(); | 
|---|
|  |  |  | return AjaxResult.success(stringIntegerMap); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @GetMapping("/List") | 
|---|
|  |  |  | @ApiOperation(value = "历史报警报警聚合接口",notes = "通过command和时间查询历史数据") | 
|---|
|  |  |  | @ApiOperationSupport(includeParameters = {"command","beginTime","endTime"},order = 4) | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name="command",value="报警标识",dataType="integer",paramType="query",example="1001",required=true), | 
|---|
|  |  |  | @ApiImplicitParam(name="beginTime",value="开始时间",dataType="string",paramType="query",example="2023-06-15 00:00:00",required=true), | 
|---|
|  |  |  | @ApiImplicitParam(name="endTime",value="结束时间",dataType="string",paramType="query",example="2023-06-15 14:18:23",required=true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public AjaxResult selectAlarmList(Integer command, String beginTime,String endTime) { | 
|---|
|  |  |  | Object alarmList = globalAlarmService.selectAlarmList(command,beginTime,endTime); | 
|---|
|  |  |  | return AjaxResult.success(alarmList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiModelProperty(value = "报警类型", name = "command", notes = "用来区分报警类型的标记", required = true) | 
|---|
|  |  |  | Integer command; | 
|---|
|  |  |  | String id; | 
|---|
|  |  |  | Date beginTime; | 
|---|
|  |  |  | Date endTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.ruoyi.alarm.globalAlarm.domain.GlobalAlarmCondition; | 
|---|
|  |  |  | import com.ruoyi.alarm.globalAlarm.domain.GlobalAlarmData; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | Object updateAlarmViewTime(GlobalAlarmCondition condition); | 
|---|
|  |  |  | public void receiveAlarm(String topic,String message); | 
|---|
|  |  |  | public Map<String,Integer> selectAlarmLogsCount(); | 
|---|
|  |  |  | Object selectAlarmList(Integer command, String beginTime, String endTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private IHikClientService hikClientService; | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private RedisCache redisCache; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @描述 按条件查询报警 | 
|---|
|  |  |  | * @参数 [condition] | 
|---|
|  |  |  | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @描述 按条件更新查看时间 | 
|---|
|  |  |  | * @参数 [condition] | 
|---|
|  |  |  | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @描述 异步处理接收的报警 | 
|---|
|  |  |  | * @参数 [topic, message] | 
|---|
|  |  |  | 
|---|
|  |  |  | double distance = GisTool.getDistance(cmd.getTargetPosition(), camPosition); | 
|---|
|  |  |  | if (distance != 0.0 && distance <= camera.getCamMaxVisibleDistance()) { | 
|---|
|  |  |  | distanceMap.put(camera.getId(), distance); | 
|---|
|  |  |  | if(StringUtils.isNull(camera.getCamAlarmGuideEnable())) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (StringUtils.isNull(camera.getCamAlarmGuideEnable())) { | 
|---|
|  |  |  | camera.setCamAlarmGuideEnable(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | guideMap.put(camera.getId(),camera.getCamAlarmGuideEnable()); | 
|---|
|  |  |  | guideMap.put(camera.getId(), camera.getCamAlarmGuideEnable()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (distanceMap.size() > 0) { | 
|---|
|  |  |  | log.debug("尝试查找最近光电"); | 
|---|
|  |  |  | //获取距离字典中最近的一个相机ID | 
|---|
|  |  |  | String minDistanceCameraId = ArdTool.getKeyByMinValue(distanceMap); | 
|---|
|  |  |  | log.debug("查找到最近光电:"+minDistanceCameraId+",尝试引导"); | 
|---|
|  |  |  | if(guideMap.get(minDistanceCameraId).equals(0)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | log.debug("查找到最近光电:" + minDistanceCameraId + ",尝试引导"); | 
|---|
|  |  |  | if (guideMap.get(minDistanceCameraId).equals(0)) { | 
|---|
|  |  |  | log.debug("该光电未开启报警引导"); | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | countMap.put("1014 ", count1014); | 
|---|
|  |  |  | return countMap; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Object selectAlarmList(Integer command, String beginTime, String endTime) { | 
|---|
|  |  |  | Map<String, Object> params = new HashMap<>(); | 
|---|
|  |  |  | params.put("beginTime", beginTime); | 
|---|
|  |  |  | params.put("endTime", endTime); | 
|---|
|  |  |  | switch (command) { | 
|---|
|  |  |  | case 1001: | 
|---|
|  |  |  | ArdAlarmStealelec aas = new ArdAlarmStealelec(); | 
|---|
|  |  |  | aas.setParams(params); | 
|---|
|  |  |  | List<ArdAlarmStealelec> ardAlarmStealelecs = ardAlarmStealelecMapper.selectArdAlarmStealelecList(aas); | 
|---|
|  |  |  | return ardAlarmStealelecs; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | case 1014: | 
|---|
|  |  |  | ArdAlarmTube aat = new ArdAlarmTube(); | 
|---|
|  |  |  | aat.setParams(params); | 
|---|
|  |  |  | List<ArdAlarmTube> ardAlarmTubes = ardAlarmTubeMapper.selectArdAlarmTubeList(aat); | 
|---|
|  |  |  | return ardAlarmTubes; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface ArdAlarmStealelecMapper{ | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询盗电报警列表 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param ardAlarmStealelec 盗电报警 | 
|---|
|  |  |  | * @return 盗电报警集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<ArdAlarmStealelec> selectArdAlarmStealelecList(ArdAlarmStealelec ardAlarmStealelec); | 
|---|
|  |  |  | int insertArdAlarmStealelec(ArdAlarmStealelec record); | 
|---|
|  |  |  | ArdAlarmStealelec selectByPrimaryKey(String id); | 
|---|
|  |  |  | List<ArdAlarmStealelec> selectRealByCondition(@Param("refreshTime")String refreshTime,@Param("deptId")Long deptId); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.ruoyi.alarm.tubeAlarm.domain.ArdAlarmTube; | 
|---|
|  |  |  | import com.ruoyi.alarm.tubeAlarm.service.IArdAlarmTubeService; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PreAuthorize("@ss.hasPermi('alarm:tubeAlarm:list')") | 
|---|
|  |  |  | @GetMapping("/list") | 
|---|
|  |  |  | @ApiOperation("查询管线泄露报警列表") | 
|---|
|  |  |  | public TableDataInfo list(ArdAlarmTube ardAlarmTube) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | startPage(); | 
|---|
|  |  |  | 
|---|
|  |  |  | <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,altitude,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> | 
|---|
|  |  |  | </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) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <update id="updateViewTimeByDescribe" parameterType="String"> | 
|---|
|  |  |  | update ard_alarm_stealelec | 
|---|
|  |  |  | 
|---|
|  |  |  | <mapper namespace="com.ruoyi.alarm.tubeAlarm.mapper.ArdAlarmTubeMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap type="ArdAlarmTube" id="ArdAlarmTubeResult"> | 
|---|
|  |  |  | <result property="id"    column="id"    /> | 
|---|
|  |  |  | <result property="host"    column="host"    /> | 
|---|
|  |  |  | <result property="tubeId"    column="tube_id"    /> | 
|---|
|  |  |  | <result property="tubeName"    column="tube_name"    /> | 
|---|
|  |  |  | <result property="tubeType"    column="tube_type"    /> | 
|---|
|  |  |  | <result property="pipeDiameter"    column="pipe_diameter"    /> | 
|---|
|  |  |  | <result property="color"    column="color"    /> | 
|---|
|  |  |  | <result property="position"    column="position"    /> | 
|---|
|  |  |  | <result property="type"    column="type"    /> | 
|---|
|  |  |  | <result property="alarmType"    column="alarm_type"    /> | 
|---|
|  |  |  | <result property="alarmTime"    column="alarm_time"    /> | 
|---|
|  |  |  | <result property="watcher"    column="watcher"    /> | 
|---|
|  |  |  | <result property="createTime"    column="create_time"    /> | 
|---|
|  |  |  | <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"    /> | 
|---|
|  |  |  | <result property="id" column="id"/> | 
|---|
|  |  |  | <result property="host" column="host"/> | 
|---|
|  |  |  | <result property="tubeId" column="tube_id"/> | 
|---|
|  |  |  | <result property="tubeName" column="tube_name"/> | 
|---|
|  |  |  | <result property="tubeType" column="tube_type"/> | 
|---|
|  |  |  | <result property="pipeDiameter" column="pipe_diameter"/> | 
|---|
|  |  |  | <result property="color" column="color"/> | 
|---|
|  |  |  | <result property="position" column="position"/> | 
|---|
|  |  |  | <result property="type" column="type"/> | 
|---|
|  |  |  | <result property="alarmType" column="alarm_type"/> | 
|---|
|  |  |  | <result property="alarmTime" column="alarm_time"/> | 
|---|
|  |  |  | <result property="watcher" column="watcher"/> | 
|---|
|  |  |  | <result property="createTime" column="create_time"/> | 
|---|
|  |  |  | <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, record_url, 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"> | 
|---|
|  |  |  | <include refid="selectArdAlarmTubeVo"/> | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="host != null  and host != ''"> and host = #{host}</if> | 
|---|
|  |  |  | <if test="tubeId != null  and tubeId != ''"> and tube_id = #{tubeId}</if> | 
|---|
|  |  |  | <if test="tubeName != null  and tubeName != ''"> and tube_name like '%'||#{tubeName}||'%'</if> | 
|---|
|  |  |  | <if test="tubeType != null  and tubeType != ''"> and tube_type = #{tubeType}</if> | 
|---|
|  |  |  | <if test="pipeDiameter != null  and pipeDiameter != ''"> and pipe_diameter = #{pipeDiameter}</if> | 
|---|
|  |  |  | <if test="color != null  and color != ''"> and color = #{color}</if> | 
|---|
|  |  |  | <if test="position != null  and position != ''"> and position = #{position}</if> | 
|---|
|  |  |  | <if test="type != null  and type != ''"> and type = #{type}</if> | 
|---|
|  |  |  | <if test="alarmType != null  and alarmType != ''"> and alarm_type = #{alarmType}</if> | 
|---|
|  |  |  | <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if> | 
|---|
|  |  |  | <if test="watcher != null  and watcher != ''"> and watcher = #{watcher}</if> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | <if test="host != null  and host != ''">and host = #{host}</if> | 
|---|
|  |  |  | <if test="tubeId != null  and tubeId != ''">and tube_id = #{tubeId}</if> | 
|---|
|  |  |  | <if test="tubeName != null  and tubeName != ''">and tube_name like '%'||#{tubeName}||'%'</if> | 
|---|
|  |  |  | <if test="tubeType != null  and tubeType != ''">and tube_type = #{tubeType}</if> | 
|---|
|  |  |  | <if test="pipeDiameter != null  and pipeDiameter != ''">and pipe_diameter = #{pipeDiameter}</if> | 
|---|
|  |  |  | <if test="color != null  and color != ''">and color = #{color}</if> | 
|---|
|  |  |  | <if test="position != null  and position != ''">and position = #{position}</if> | 
|---|
|  |  |  | <if test="type != null  and type != ''">and type = #{type}</if> | 
|---|
|  |  |  | <if test="alarmType != null  and alarmType != ''">and alarm_type = #{alarmType}</if> | 
|---|
|  |  |  | <!--<if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>--> | 
|---|
|  |  |  | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 
|---|
|  |  |  | AND alarm_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> | 
|---|
|  |  |  | AND alarm_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="watcher != null  and watcher != ''">and watcher = #{watcher}</if> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteArdAlarmTubeById" parameterType="String"> | 
|---|
|  |  |  | delete from ard_alarm_tube where id = #{id} | 
|---|
|  |  |  | delete | 
|---|
|  |  |  | from ard_alarm_tube | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteArdAlarmTubeByIds" parameterType="String"> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | ard_alarm_tube aat | 
|---|
|  |  |  | 
|---|
|  |  |  | update ard_alarm_tube | 
|---|
|  |  |  | set view_time=#{viewTime} | 
|---|
|  |  |  | where tube_id = #{tubeId} | 
|---|
|  |  |  | and alarm_time<=#{alarmTime} | 
|---|
|  |  |  | and alarm_time <= #{alarmTime} | 
|---|
|  |  |  | and view_time is null | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | </mapper> | 
|---|
|  |  |  | 
|---|
|  |  |  | @JsonInclude(JsonInclude.Include.NON_EMPTY) | 
|---|
|  |  |  | @ApiModelProperty(value = "动态参数", name = "params", notes = "根据不同的查询字段自由配置参数") | 
|---|
|  |  |  | private Map<String, Object> params; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiModelProperty(value = "页码", name = "pageNum", notes = "页码", required = true) | 
|---|
|  |  |  | private Integer pageNum; | 
|---|
|  |  |  | @ApiModelProperty(value = "页大小", name = "pageSize", notes = "页大小", required = true) | 
|---|