增加视频资源申请时查询该资源是否在库中的判断cameraChannelService.checkCameraIfExists

This commit is contained in:
yitonglei 2022-07-25 18:00:29 +08:00
parent 6fedef22c0
commit 4d2141d807
4 changed files with 35 additions and 1 deletions

View File

@ -704,4 +704,9 @@ public class Controller {
}
/******************************2022/07/13 ytl修改视频资源 end********************************************/
@GetMapping("/checkCameraIfExists")
public Result checkCameraIfExists(@RequestParam List<String> list){
Result result = cameraChannelService.checkCameraIfExists(list);
return result;
}
}

View File

@ -75,4 +75,6 @@ public interface CameraChannelMapper extends BaseDao<CameraChannel> {
@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);
}

View File

@ -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<String> channelList){
List<Map> exists = new ArrayList<>();
Iterator<String> 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<String,Object> result = new HashMap<>();
result.put("exists",exists);
result.put("nonExists",channelList);
return Result.success(result);
}
}

View File

@ -237,4 +237,9 @@
(#{item.channel_code},#{item.label_code})
</foreach>
</insert>
<select id="selectCameraChannelById" parameterType="java.lang.String" resultType="java.util.Map">
SELECT channel_id AS channelId,channel_name AS channelName FROM t_camera_channel
WHERE channel_id = #{channelId} LIMIT 1
</select>
</mapper>