DeviceController.java
1.97 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
51
52
53
package cn.com.glsx.stdinterface.modules.controller;
import cn.com.glsx.stdinterface.api.DeviceClient;
import cn.com.glsx.stdinterface.dto.DeviceDto;
import cn.com.glsx.stdinterface.modules.service.DeviceService;
import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.common.enums.OperateType;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.List;
/**
* 设备 controller
*
* @author yangll
*/
@Slf4j
@RestController
@RequestMapping(value = "/device")
public class DeviceController implements DeviceClient {
private final static String MODULE = "设备模块";
@Autowired
private DeviceService deviceService;
@Override
@GetMapping("/getDeviceBySn")
@SysLog(module = MODULE, value = "根据设备号获取设备实体类", action = OperateType.QUERY, saveLog = false)
@ApiOperation(value = "根据设备号获取设备实体类")
public R<DeviceDto> getDeviceBySn(@RequestParam String sn) {
DeviceDto deviceBySn = deviceService.getDeviceBySn(sn);
return R.ok().data(deviceBySn);
}
@Override
@PostMapping("/selectBySns")
@SysLog(module = MODULE, value = "根据设备号集合获取设备信息", action = OperateType.QUERY, saveLog = false)
@ApiOperation(value = "根据设备号集合获取设备信息")
public R<List<DeviceDto>> selectBySns(@RequestBody Collection<String> sns) {
List<DeviceDto> list = deviceService.selectBySns(sns);
return R.ok().data(list);
}
}