package com.ruoyi.device.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.device.pojo.DeviceAccidentReport;
import com.ruoyi.device.service.DeviceAccidentReportService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
/**
*
* 设备事故报告单 前端控制器
*
*
* @author 江苏鵷雏网络科技有限公司
* @since 2024-12-17 06:31:12
*/
@Tag(name = "设备事故报告单")
@AllArgsConstructor
@RestController
@RequestMapping("/deviceAccidentReport")
public class DeviceAccidentReportController {
private DeviceAccidentReportService deviceAccidentReportService;
/**
* 设备事故报告列表
* @return
*/
@Operation(summary = "设备事故报告列表")
@GetMapping("/pageDeviceAccidentReport")
public Result> pageDeviceAccidentReport(Page page, DeviceAccidentReport deviceAccidentReport){
return Result.success(deviceAccidentReportService.pageDeviceAccidentReport(page, deviceAccidentReport));
}
/**
* 查询设备事故报告
* @return
*/
@Operation(summary = "查询设备事故报告")
@GetMapping("/getDeviceAccidentReport")
public Result getDeviceAccidentReport(Integer accidentReportId){
return Result.success(deviceAccidentReportService.getById(accidentReportId));
}
/**
* 删除设备事故报告
* @return
*/
@Operation(summary = "删除设备事故报告")
@DeleteMapping("/delDeviceAccidentReport")
public Result delDeviceAccidentReport(Integer accidentReportId){
return Result.success(deviceAccidentReportService.removeById(accidentReportId));
}
/**
* 新增设备事故报告
* @return
*/
@Operation(summary = "新增设备事故报告")
@PostMapping("/addDeviceAccidentReport")
public Result addDeviceAccidentReport(@RequestBody DeviceAccidentReport deviceAccidentReport){
return Result.success(deviceAccidentReportService.addDeviceAccidentReport(deviceAccidentReport));
}
/**
* 导出设备事故报告
* @param accidentReportId 设备事故报告id
* @param response 响应
*/
@Operation(summary = "导出设备事故报告")
@GetMapping("/exportDeviceAccidentReport")
public Result exportDeviceAccidentReport(Integer accidentReportId, HttpServletResponse response) {
deviceAccidentReportService.exportDeviceAccidentReport(accidentReportId, response);
return Result.success();
}
}