RepairRecController.java
2.07 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
56
57
58
59
60
61
62
63
64
65
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.array.ArrayUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.RepairRecDTO;
import vion.service.IRepairRecService;
import vion.vo.RepairRecVO;
import java.util.List;
/**
* 返修申请
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/repairRec")
public class RepairRecController {
private final IRepairRecService repairRecService;
@PostMapping("/frontSubmit")
public Object frontSubmit(RepairRecDTO dto) {
return repairRecService.frontSubmit(dto);
}
@GetMapping
@SaCheckPermission(value = "repairRec:list", orRole = "admin")
public List<RepairRecVO> list(RepairRecDTO dto) {
Assert.isTrue(ArrayUtil.isAllNotNull(dto.getCreateTimeStart(), dto.getCreateTimeEnd()), "查询时间范围不能为空");
return repairRecService.list(dto);
}
@GetMapping("/{id}")
@SaCheckPermission(value = "repairRec:query", orRole = "admin")
public RepairRecVO getById(@PathVariable Long id) {
return repairRecService.getRepairRecDetail(id, null);
}
@GetMapping("/get/{uuid}")
public RepairRecVO getByUuid(@PathVariable String uuid) {
return repairRecService.getRepairRecDetail(null, uuid);
}
@PostMapping("/{id}")
@SaCheckPermission(value = "repairRec:edit", orRole = "admin")
public String updById(@PathVariable Long id, RepairRecDTO dto) {
return repairRecService.updById(id, dto);
}
@DeleteMapping("/{id}")
@SaCheckPermission(value = "repairRec:remove", orRole = "admin")
public String delById(@PathVariable Long id) {
return repairRecService.removeById(id) ? "删除成功" : "删除失败";
}
@GetMapping("/notify")
@SaCheckPermission(value = "repairRec:notify", orRole = "admin")
public String notify(Long id, String userid) {
return repairRecService.notify(id, userid) ? "钉钉提醒成功" : "钉钉提醒失败";
}
}