xiangpei
2025-02-11 d0b275ac9b4b071359356edf238e7d0c9114dbd1
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
package com.ycl.controller;
 
 
import com.ycl.common.base.Result;
import com.ycl.common.group.Add;
import com.ycl.common.group.Update;
import com.ycl.domain.form.ProjectPlanRecordAddRequestForm;
import com.ycl.domain.form.ProjectPlanRecordForm;
import com.ycl.domain.query.ProjectPlanRecordQuery;
import com.ycl.service.ProjectPlanRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotEmpty;
import java.util.List;
 
/**
 * 项目计划记录 前端控制器
 *
 * @author lhr
 * @since 2024-11-22
 */
@Validated
@RequiredArgsConstructor
@Api(value = "项目计划记录", tags = "项目计划记录管理")
@RestController
@RequestMapping("/api/project-plan-record")
public class ProjectPlanRecordController {
 
    private final ProjectPlanRecordService projectPlanRecordService;
 
    @PostMapping
    @ApiOperation(value = "添加", notes = "添加")
//    @PreAuthorize("hasAuthority('projectPlanRecord:add')")
    public Result add(@RequestBody @Validated(Add.class) ProjectPlanRecordAddRequestForm form) {
        return projectPlanRecordService.add(form);
    }
 
    @PutMapping
    @ApiOperation(value = "修改", notes = "修改")
    @PreAuthorize("hasAuthority('projectPlanRecord:edit')")
    public Result update(@RequestBody @Validated(Update.class) ProjectPlanRecordForm form) {
        return projectPlanRecordService.update(form);
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "ID删除", notes = "ID删除")
//    @PreAuthorize("hasAuthority('projectPlanRecord:del')")
    public Result removeById(@PathVariable("id") Long id) {
        return projectPlanRecordService.removeById(id);
    }
 
    @DeleteMapping("/batch")
    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PreAuthorize("hasAuthority('projectPlanRecord:del:batch')")
    public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) {
        return projectPlanRecordService.remove(ids);
    }
 
    @GetMapping("/page")
    @ApiOperation(value = "分页", notes = "分页")
    @PreAuthorize("hasAuthority('projectPlanRecord:page')")
    public Result page(ProjectPlanRecordQuery query) {
        return projectPlanRecordService.page(query);
    }
 
    @PostMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
//    @PreAuthorize("hasAuthority('projectPlanRecord:detail')")
    public Result detail(@PathVariable("id") Long id) {
        return projectPlanRecordService.detail(id);
    }
 
    @GetMapping("/list")
    @PreAuthorize("hasAuthority('projectPlanRecord:list')")
    @ApiOperation(value = "列表", notes = "列表")
    public Result list() {
        return projectPlanRecordService.all();
    }
}