DeviceController.java
1.63 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
54
55
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.lang.Assert;
import org.springframework.web.bind.annotation.*;
import vion.dto.DeviceDTO;
import vion.service.IDeviceService;
import vion.vo.DeviceVO;
import java.util.List;
/**
* 设备管理
*/
@RestController
@RequestMapping("/api/device")
@RequiredArgsConstructor
public class DeviceController {
private final IDeviceService deviceService;
@GetMapping
@SaCheckPermission(value = "device:list", orRole = "admin")
public Page<DeviceVO> list(DeviceDTO dto) {
Assert.notNull(dto.getStatus(), "status 不能为空!");
return deviceService.list(dto);
}
@GetMapping("/{id}")
@SaCheckPermission(value = "device:query", orRole = "admin")
public DeviceVO getById(@PathVariable Long id) {
return deviceService.getById(id);
}
@PostMapping
@SaCheckPermission(value = "device:edit", orRole = "admin")
public String update(@RequestBody List<DeviceDTO> dtoList) {
return deviceService.update(dtoList);
}
@PostMapping("/record")
@SaCheckPermission(value = "device:record", orRole = "admin")
public String circulate(@RequestBody List<DeviceDTO> dtoList) {
return deviceService.recordDevice(dtoList);
}
@PostMapping("/circulate")
@SaCheckPermission(value = "device:circulateBatch", orRole = "admin")
public String circulateBatch(@RequestBody List<DeviceDTO> dtoList) {
return deviceService.circulateBatch(dtoList);
}
}