xiangpei
2024-04-23 6fe2d3e9a1348078cc7ffad1c55968c5ad97e207
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.ycl.platform.controller;
 
import com.ycl.platform.domain.form.BatchEditPointForm;
import com.ycl.system.domain.group.Update;
import com.ycl.system.domain.group.Add;
import jakarta.validation.constraints.NotBlank;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import lombok.RequiredArgsConstructor;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import jakarta.validation.constraints.NotEmpty;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ycl.platform.service.YwPointService;
import com.ycl.system.Result;
import com.ycl.platform.domain.form.YwPointForm;
import com.ycl.platform.domain.query.YwPointQuery;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
/**
 * 运维点位 前端控制器
 *
 * @author xp
 * @since 2024-03-05
 */
@Validated
@RequiredArgsConstructor
@Api(value = "运维点位", tags = "运维点位管理")
@RestController
@RequestMapping("/yw-point")
public class YwPointController {
 
    private final YwPointService ywPointService;
 
    @PostMapping
    @ApiOperation(value = "添加", notes = "添加")
    @PreAuthorize("@ss.hasPermi('point:add')")
    public Result add(@RequestBody @Validated(Add.class) YwPointForm form) {
        return ywPointService.add(form);
    }
 
    @PostMapping("/batch")
    @ApiOperation(value = "批量添加", notes = "批量添加")
    @PreAuthorize("@ss.hasPermi('point:add')")
    public Result batchAdd(@RequestBody @NotEmpty(message = "数据不能为空") List<YwPointForm> form) {
        return ywPointService.batchAdd(form);
    }
 
    @PutMapping
    @ApiOperation(value = "修改", notes = "修改")
    @PreAuthorize("@ss.hasPermi('point:edit')")
    public Result update(@RequestBody @Validated(Update.class) YwPointForm form) {
        return ywPointService.update(form);
    }
 
    @PutMapping("/batch")
    @ApiOperation(value = "批量修改运维单位", notes = "批量修改运维单位")
    @PreAuthorize("@ss.hasPermi('point:edit')")
    public Result batchEdit(@RequestBody @Validated BatchEditPointForm form) {
        return ywPointService.batchEdit(form);
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "ID删除", notes = "ID删除")
    @PreAuthorize("@ss.hasPermi('point:remove')")
    public Result removeById(@PathVariable("id") String id) {
        return ywPointService.removeById(id);
    }
 
    @DeleteMapping("/batch")
    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PreAuthorize("@ss.hasPermi('point:remove')")
    public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) {
        return ywPointService.remove(ids);
    }
 
    @GetMapping("/page")
    @ApiOperation(value = "分页", notes = "分页")
    @PreAuthorize("@ss.hasPermi('point:page')")
    public Result page(YwPointQuery query) {
        return ywPointService.page(query);
    }
 
    @GetMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
    @PreAuthorize("@ss.hasPermi('point:query')")
    public Result detail(@PathVariable("id") String id) {
        return ywPointService.detail(id);
    }
 
    @GetMapping("/list")
    @ApiOperation(value = "列表", notes = "列表")
    @PreAuthorize("@ss.hasPermi('point:list')")
    public Result list() {
        return ywPointService.all();
    }
 
    @GetMapping("/select")
    @ApiOperation(value = "点位下拉", notes = "点位下拉")
    public Result select(@NotBlank(message = "请输入点位") String keyword) {
        return ywPointService.select(keyword);
    }
}