| | |
| | | package com.sinata.web.controller.backend; |
| | | |
| | | import com.sinata.common.core.domain.R; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.dto.MwProtectionTaskDTO; |
| | | import com.sinata.system.domain.query.MwProtectionTaskQuery; |
| | | import com.sinata.system.domain.vo.MwProtectionTaskVO; |
| | | import com.sinata.system.service.MwProtectionTaskService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author mitao |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Validated |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = {"防护作业相关接口"}) |
| | | @RequestMapping("/backend/mwProtectionTask") |
| | | public class MwProtectionTaskController { |
| | | private final MwProtectionTaskService mwProtectionTaskService; |
| | | |
| | | /** |
| | | * 防护作业分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @ApiOperation("防护作业分页列表") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<MwProtectionTaskVO>> pageList(@Valid @RequestBody MwProtectionTaskQuery query) { |
| | | return R.ok(mwProtectionTaskService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 防护作业详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation("防护作业详情") |
| | | @GetMapping("/{id}") |
| | | public R<MwProtectionTaskVO> detail(@ApiParam(name = "id", value = "防护作业id", required = true) @PathVariable("id") Long id) { |
| | | return R.ok(mwProtectionTaskService.detail(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增防护作业 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @ApiOperation("新增防护作业") |
| | | @PostMapping("/add") |
| | | public R<?> add(@Valid @RequestBody MwProtectionTaskDTO dto) { |
| | | mwProtectionTaskService.add(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑防护作业 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @ApiOperation("编辑防护作业") |
| | | @PostMapping("/edit") |
| | | public R<?> edit(@Valid @RequestBody MwProtectionTaskDTO dto) { |
| | | mwProtectionTaskService.edit(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation("删除") |
| | | @DeleteMapping("/{id}") |
| | | public R<?> delete(@ApiParam(name = "id", value = "防护作业id", required = true) @PathVariable("id") Long id) { |
| | | mwProtectionTaskService.delete(id); |
| | | return R.ok(); |
| | | } |
| | | } |