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.ProjectPlanInfoForm; import com.ycl.domain.form.ProjectPlanInfoRequestForm; import com.ycl.domain.query.ProjectPlanInfoQuery; import com.ycl.service.ProjectPlanInfoService; 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-info") public class ProjectPlanInfoController { private final ProjectPlanInfoService projectPlanInfoService; @PostMapping @ApiOperation(value = "添加", notes = "添加") // @PreAuthorize("hasAuthority('projectPlanInfo:add')") public Result add(@RequestBody @Validated(Add.class) ProjectPlanInfoForm form) { return projectPlanInfoService.add(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") @PreAuthorize("hasAuthority('projectPlanInfo:edit')") public Result update(@RequestBody @Validated(Update.class) ProjectPlanInfoForm form) { return projectPlanInfoService.update(form); } @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") @PreAuthorize("hasAuthority('projectPlanInfo:del')") public Result removeById(@PathVariable("id") String id) { return projectPlanInfoService.removeById(id); } @DeleteMapping("/batch") @ApiOperation(value = "批量删除", notes = "批量删除") @PreAuthorize("hasAuthority('projectPlanInfo:del:batch')") public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List ids) { return projectPlanInfoService.remove(ids); } @GetMapping("/page") @ApiOperation(value = "分页", notes = "分页") @PreAuthorize("hasAuthority('projectPlanInfo:page')") public Result page(ProjectPlanInfoQuery query) { return projectPlanInfoService.page(query); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") // @PreAuthorize("hasAuthority('projectPlanInfo:detail')") public Result detail(@PathVariable("id") Long id) { return projectPlanInfoService.detail(id); } @GetMapping("/list") @PreAuthorize("hasAuthority('projectPlanInfo:list')") @ApiOperation(value = "列表", notes = "列表") public Result list() { return projectPlanInfoService.all(); } @PostMapping("/addPlanInfo") public Result addPlanInfo(@RequestBody @Validated ProjectPlanInfoRequestForm form) { return projectPlanInfoService.addPlanInfo(form); } @PostMapping("/resubmitPlanInfo") public Result resubmitPlanInfo(@RequestBody @Validated(Add.class) ProjectPlanInfoForm form) { return projectPlanInfoService.resubmitPlanInfo(form); } @PostMapping("/savePlanInfo/{planRecordId}") public Result savePlanInfo(@RequestBody ProjectPlanInfoForm item, @PathVariable("planRecordId") Long planRecordId) { return projectPlanInfoService.savePlanInfo(item, planRecordId); } @PostMapping("/delayPlanInfo") public Result delayPlanInfo(@RequestBody ProjectPlanInfoForm request) { return projectPlanInfoService.delayPlanInfo(request); } }