From 4d2141d80749fca72d4d43a3cc659a5709824fd4 Mon Sep 17 00:00:00 2001 From: yitonglei Date: Mon, 25 Jul 2022 18:00:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A7=86=E9=A2=91=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=94=B3=E8=AF=B7=E6=97=B6=E6=9F=A5=E8=AF=A2=E8=AF=A5?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=98=AF=E5=90=A6=E5=9C=A8=E5=BA=93=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=ADcameraChannelService.checkCameraIfEx?= =?UTF-8?q?ists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/controller/Controller.java | 5 ++++ .../monitor/mapper/CameraChannelMapper.java | 2 ++ .../monitor/service/CameraChannelService.java | 24 ++++++++++++++++++- .../mapper/monitor/CameraChannelMapper.xml | 5 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java b/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java index 5b8c7a23..26acea28 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java @@ -704,4 +704,9 @@ public class Controller { } /******************************2022/07/13 ytl修改视频资源 end********************************************/ + @GetMapping("/checkCameraIfExists") + public Result checkCameraIfExists(@RequestParam List list){ + Result result = cameraChannelService.checkCameraIfExists(list); + return result; + } } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java index 642f5c6b..85246e42 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java @@ -75,4 +75,6 @@ public interface CameraChannelMapper extends BaseDao { @Delete("delete from t_camera_channel where gps_x is null or gps_y is null or gps_x = '' or gps_y = '' ") void deleteByNonPlace(); + + Map selectCameraChannelById(@Param("channelId") String channelId); } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/service/CameraChannelService.java b/renren-admin/src/main/java/io/renren/modules/monitor/service/CameraChannelService.java index 19688fb2..d5f79fa0 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/service/CameraChannelService.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/service/CameraChannelService.java @@ -2,6 +2,7 @@ package io.renren.modules.monitor.service; import com.alibaba.fastjson.JSONObject; import io.renren.modules.monitor.dto.CameraChannelDto; +import io.renren.modules.monitor.entity.Result; import io.renren.modules.monitor.mapper.CameraChannelMapper; import io.renren.modules.monitor.utils.EhcacheUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -9,7 +10,7 @@ import org.springframework.cache.ehcache.EhCacheCacheManager; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import java.util.List; +import java.util.*; /** * @author admin @@ -38,4 +39,25 @@ public class CameraChannelService { return list; } + //根据输入的channel_id的列表查询到系统中存在的cameraChannel信息 + public Result checkCameraIfExists(List channelList){ + List exists = new ArrayList<>(); + + Iterator iterator = channelList.iterator(); + while(iterator.hasNext()){ + String s = iterator.next(); + Map map = cameraChannelMapper.selectCameraChannelById(s); + if(map != null && !map.isEmpty()){ + exists.add(map); + iterator.remove(); + } + } + + Map result = new HashMap<>(); + result.put("exists",exists); + result.put("nonExists",channelList); + + return Result.success(result); + } + } diff --git a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml index 47c2678a..53d264b3 100644 --- a/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml +++ b/renren-admin/src/main/resources/mapper/monitor/CameraChannelMapper.xml @@ -237,4 +237,9 @@ (#{item.channel_code},#{item.label_code}) + + \ No newline at end of file