TaskTempController.java
1.87 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
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import vion.dto.TaskTempDTO;
import vion.model.TaskTemp;
import vion.service.ITaskTempService;
import vion.vo.TaskTempVO;
import java.util.Map;
/**
* 预工单
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
@Slf4j
public class TaskTempController {
private final ITaskTempService taskTempService;
private final Converter converter;
@GetMapping("/taskTemps")
@SaCheckPermission(value = "taskTemp:list", orRole = "admin")
public Page<TaskTempVO> getTaskTempList(TaskTempDTO data) {
return taskTempService.getTaskTempList(data);
}
@GetMapping("/taskTemp")
@SaCheckPermission(value = "taskTemp:query", orRole = "admin")
public TaskTempVO getTaskTempById(Long id) {
return taskTempService.getTaskTempById(id);
}
@PostMapping("/taskTemp")
@SaCheckPermission(value = "taskTemp:save", orRole = "admin")
public Object saveTaskTemp(TaskTempDTO data) {
return taskTempService.saveTaskTemp(data);
}
@PostMapping("/taskTemp/{id}")
@SaCheckPermission(value = "taskTemp:edit", orRole = "admin")
public String upd(@PathVariable(name = "id") Long id, TaskTempDTO data) {
TaskTemp taskTemp = converter.convert(data, TaskTemp.class);
taskTemp.setId(id);
return taskTempService.updateById(taskTemp) ? "更新成功" : "更新失败";
}
@GetMapping("/taskTemp/getInfoByPhone")
@SaCheckPermission(value = "task:getInfoByPhone", orRole = "admin")
public Map<String, Long> getInfoByPhone(String phone) {
return taskTempService.getInfoByPhone(phone);
}
}