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.ProgressPlanForm; import com.ycl.domain.query.ProgressPlanQuery; import com.ycl.domain.form.ProjectProgressFileListsForm; import com.ycl.mapper.FileMapper; import com.ycl.service.ProgressPlanService; 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/progress-plan") public class ProgressPlanController { private final ProgressPlanService progressPlanService; private final FileMapper fileMapper; @PostMapping @ApiOperation(value = "添加", notes = "添加") @PreAuthorize("hasAuthority('progressPlan:add')") public Result add(@RequestBody @Validated(Add.class) ProgressPlanForm form) { return progressPlanService.add(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") @PreAuthorize("hasAuthority('progressPlan:edit')") public Result update(@RequestBody @Validated(Update.class) ProgressPlanForm form) { return progressPlanService.update(form); } @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") @PreAuthorize("hasAuthority('progressPlan:del')") public Result removeById(@PathVariable("id") String id) { return progressPlanService.removeById(id); } @DeleteMapping("/batch") @ApiOperation(value = "批量删除", notes = "批量删除") @PreAuthorize("hasAuthority('progressPlan:del:batch')") public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List ids) { return progressPlanService.remove(ids); } @GetMapping("/page") @ApiOperation(value = "分页", notes = "分页") @PreAuthorize("hasAuthority('progressPlan:page')") public Result page(ProgressPlanQuery query) { return progressPlanService.page(query); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") // @PreAuthorize("hasAuthority('progressPlan:detail')") public Result detail(@PathVariable("id") Long id) { return progressPlanService.detail(id); } @GetMapping("/list") @PreAuthorize("hasAuthority('progressPlan:list')") @ApiOperation(value = "列表", notes = "列表") public Result list() { return progressPlanService.all(); } @PostMapping("/saveProjectProgressFileLists") public Result saveProjectProgressFileLists(@RequestBody ProjectProgressFileListsForm form) { return progressPlanService.saveProjectProgressFileLists(form); } @GetMapping("/getProjectProgressForm/{id}") public Result getProjectProgressForm(@PathVariable("id") Long id) { return progressPlanService.getProjectProgressForm(id); } }