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.ProjectPlanProgressReportForm; import com.ycl.domain.query.ProjectPlanProgressReportQuery; import com.ycl.domain.form.ProgressReportResponseForm; import com.ycl.service.ProjectPlanProgressReportService; 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-progress-report") public class ProjectPlanProgressReportController { private final ProjectPlanProgressReportService projectPlanProgressReportService; @PostMapping @ApiOperation(value = "添加", notes = "添加") // @PreAuthorize("hasAuthority('projectPlanProgressReport:add')") public Result add(@RequestBody @Validated(Add.class) ProgressReportResponseForm form) { return projectPlanProgressReportService.add(form); } @PostMapping("/examine") public Result examine(@RequestBody @Validated(Add.class) ProgressReportResponseForm form) { return projectPlanProgressReportService.examine(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") @PreAuthorize("hasAuthority('projectPlanProgressReport:edit')") public Result update(@RequestBody @Validated(Update.class) ProjectPlanProgressReportForm form) { return projectPlanProgressReportService.update(form); } @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") @PreAuthorize("hasAuthority('projectPlanProgressReport:del')") public Result removeById(@PathVariable("id") String id) { return projectPlanProgressReportService.removeById(id); } @DeleteMapping("/batch") @ApiOperation(value = "批量删除", notes = "批量删除") @PreAuthorize("hasAuthority('projectPlanProgressReport:del:batch')") public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List ids) { return projectPlanProgressReportService.remove(ids); } @GetMapping("/page") @ApiOperation(value = "分页", notes = "分页") @PreAuthorize("hasAuthority('projectPlanProgressReport:page')") public Result page(ProjectPlanProgressReportQuery query) { return projectPlanProgressReportService.page(query); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") // @PreAuthorize("hasAuthority('projectPlanProgressReport:detail')") public Result detail(@PathVariable("id") Long id) { return projectPlanProgressReportService.detail(id); } @GetMapping("/list") @PreAuthorize("hasAuthority('projectPlanProgressReport:list')") @ApiOperation(value = "列表", notes = "列表") public Result list() { return projectPlanProgressReportService.all(); } }