DeviceController.java
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.genersoft.iot.vmp.vmanager.device;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
@RestController
@RequestMapping("/api")
public class DeviceController {
private final static Logger logger = LoggerFactory.getLogger(DeviceController.class);
@Autowired
private IVideoManagerStorager storager;
@GetMapping("/devices/{deviceId}")
public ResponseEntity<List<Device>> devices(@PathVariable String deviceId){
if (logger.isDebugEnabled()) {
logger.debug("查询视频设备API调用,deviceId:" + deviceId);
}
List<Device> deviceList = new ArrayList<>();
deviceList.add(storager.queryVideoDevice(deviceId));
return new ResponseEntity<>(deviceList,HttpStatus.OK);
}
@GetMapping("/devices")
public ResponseEntity<List<Device>> devices(){
if (logger.isDebugEnabled()) {
logger.debug("查询所有视频设备API调用");
}
List<Device> deviceList = storager.queryVideoDeviceList(null);
return new ResponseEntity<>(deviceList,HttpStatus.OK);
}
}