zss
5 天以前 bc9d5f232f55ca5a98e140252288f56ae23e6793
src/main/java/com/ruoyi/safe/controller/SafeAccidentController.java
@@ -1,11 +1,13 @@
package com.ruoyi.safe.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.safe.pojo.SafeAccident;
import com.ruoyi.safe.service.SafeAccidentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@@ -22,30 +24,33 @@
@RestController
@RequestMapping("/safeAccident")
@AllArgsConstructor
@Api(tags = "安全生产--事故上报记录")
@Tag(name = "安全生产--事故上报记录")
public class SafeAccidentController {
    private SafeAccidentService safeAccidentService;
    @GetMapping("/page")
    @ApiOperation("分页查询")
    @Operation(summary = "分页查询")
    public R page(Page page, SafeAccident safeAccident) {
        return R.ok(safeAccidentService.pageSafeAccident(page, safeAccident));
    }
    @ApiOperation("新增事故上报记录")
    @Operation(summary = "新增事故上报记录")
    @Log(title = "安全事故", businessType = BusinessType.INSERT)
    @PostMapping()
    public R add(@RequestBody SafeAccident safeAccident) {
        return R.ok(safeAccidentService.save(safeAccident));
    }
    @ApiOperation("修改事故上报记录")
    @Operation(summary = "修改事故上报记录")
    @Log(title = "安全事故", businessType = BusinessType.UPDATE)
    @PutMapping ()
    public R update(@RequestBody  SafeAccident safeAccident) {
        return R.ok(safeAccidentService.updateById(safeAccident));
    }
    @ApiOperation("删除事故上报记录")
    @Operation(summary = "删除事故上报记录")
    @Log(title = "安全事故", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R delSafeAccident(@RequestBody List<Integer> ids) {
        return R.ok(safeAccidentService.removeBatchByIds(ids));