RRepairDeviceController.java
1.76 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
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.model.RRepairDevice;
import vion.service.IRRepairDeviceService;
/**
* 备件、维修与设备关联
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/rRepairDevice")
public class RRepairDeviceController {
private final IRRepairDeviceService repairDeviceService;
@GetMapping("/{id}")
@SaCheckPermission(value = "rRepairDevice:query", orRole = "admin")
public RRepairDevice getById(@PathVariable Long id) {
return repairDeviceService.getById(id);
}
@GetMapping
@SaCheckPermission(value = "rRepairDevice:list", orRole = "admin")
public Page<RRepairDevice> list(RRepairDevice dto) {
return repairDeviceService.lambdaQuery(dto)
.orderByDesc(RRepairDevice::getCreateTime)
.page(Page.of(dto.getPageNum(), dto.getPageSize()));
}
@PostMapping
@SaCheckPermission(value = "rRepairDevice:save", orRole = "admin")
public String save(@RequestBody RRepairDevice dto) {
return repairDeviceService.save(dto) ? "保存成功" : "保存失败";
}
@PostMapping("/{id}")
@SaCheckPermission(value = "rRepairDevice:edit", orRole = "admin")
public String updById(@RequestBody RRepairDevice dto) {
return repairDeviceService.updateById(dto) ? "修改成功" : "修改失败";
}
@DeleteMapping("/{id}")
@SaCheckPermission(value = "rRepairDevice:remove", orRole = "admin")
public String delById(@PathVariable Long id) {
return repairDeviceService.removeById(id) ? "删除成功" : "删除失败";
}
}