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