liuyu
21 小时以前 6eef0b6730d940ef44e0f66dd8e7d178f1cd2d1f
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
66
67
68
69
70
71
72
73
74
75
76
77
78
package jnpf.tmsController;
 
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.tmsEntity.evalmode.TmsEvalModeForm;
import jnpf.tmsEntity.evalmode.TmsEvalModeQuery;
import jnpf.tmsService.TmsEvalModeService;
import jnpf.util.JsonUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
import java.util.Map;
 
/**
 * 考核方式。网关 /api/tms/eval-mode/** (StripPrefix=2)→ /eval-mode/**
 */
@Tag(name = "TMS考核方式", description = "EvalMode")
@RestController
@RequestMapping("/eval-mode")
@RequiredArgsConstructor
public class TmsEvalModeController {
 
    private final TmsEvalModeService evalModeService;
 
    @Operation(summary = "考核方式分页列表")
    @GetMapping("/list")
    public ActionResult<PageListVO<TmsEvalModeForm>> list(TmsEvalModeQuery query) {
        List<TmsEvalModeForm> list = evalModeService.getList(query);
        PageListVO<TmsEvalModeForm> vo = new PageListVO<>();
        vo.setList(list);
        vo.setPagination(JsonUtil.getJsonToBean(query, PaginationVO.class));
        return ActionResult.success(vo);
    }
 
    @Operation(summary = "考核方式详情")
    @GetMapping("/{id}")
    public ActionResult<TmsEvalModeForm> info(@PathVariable("id") String id) {
        return ActionResult.success(evalModeService.getInfo(id));
    }
 
    @Operation(summary = "新增考核方式")
    @PostMapping
    public ActionResult<String> create(@RequestBody TmsEvalModeForm form) {
        return ActionResult.success(evalModeService.create(form));
    }
 
    @Operation(summary = "更新考核方式")
    @PutMapping("/{id}")
    public ActionResult<String> update(@PathVariable("id") String id, @RequestBody TmsEvalModeForm form) {
        evalModeService.update(id, form);
        return ActionResult.success("更新成功");
    }
 
    @Operation(summary = "启用/停用")
    @PutMapping("/{id}/enabled")
    public ActionResult<String> enabled(@PathVariable("id") String id, @RequestBody Map<String, String> body) {
        evalModeService.setEnabled(id, body == null ? null : body.get("enabled"));
        return ActionResult.success("操作成功");
    }
 
    @Operation(summary = "删除考核方式")
    @DeleteMapping("/{id}")
    public ActionResult<String> delete(@PathVariable("id") String id) {
        evalModeService.delete(id);
        return ActionResult.success("删除成功");
    }
}