package com.zc.business.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.zc.business.domain.DcEventAccident; import com.zc.business.enums.UniversalEnum; import com.zc.business.service.IDcEventAccidentService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 交通事故事件Controller * * @author ruoyi * @date 2024-01-12 */ @Api(tags = "交通事故事件") @RestController @RequestMapping("/system/accident") public class DcEventAccidentController extends BaseController { @Autowired private IDcEventAccidentService dcEventAccidentService; /** * 查询交通事故事件列表 */ @ApiOperation("查询交通事故事件列表") // @PreAuthorize("@ss.hasPermi('system:accident:list')") @GetMapping("/list") public TableDataInfo list(DcEventAccident dcEventAccident) { startPage(); List list = dcEventAccidentService.selectDcEventAccidentList(dcEventAccident); return getDataTable(list); } /** * 导出交通事故事件列表 */ @ApiOperation("导出交通事故事件列表") //@PreAuthorize("@ss.hasPermi('system:accident:export')") @Log(title = "交通事故事件", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcEventAccident dcEventAccident) { List list = dcEventAccidentService.selectDcEventAccidentList(dcEventAccident); ExcelUtil util = new ExcelUtil<>(DcEventAccident.class); util.exportExcel(response, list, UniversalEnum.TRAFFIC_ACCIDENT_DATA.getValue()); } /** * 获取交通事故事件详细信息 */ @ApiOperation("获取交通事故事件详细信息") // @PreAuthorize("@ss.hasPermi('system:accident:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { return AjaxResult.success(dcEventAccidentService.selectDcEventAccidentById(id)); } /** * 新增交通事故事件 */ @ApiOperation("新增交通事故事件") // @PreAuthorize("@ss.hasPermi('system:accident:add')") @Log(title = "交通事故事件", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcEventAccident dcEventAccident) { return toAjax(dcEventAccidentService.insertDcEventAccident(dcEventAccident)); } /** * 修改交通事故事件 */ @ApiOperation("修改交通事故事件") //@PreAuthorize("@ss.hasPermi('system:accident:edit')") @Log(title = "交通事故事件", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcEventAccident dcEventAccident) { return toAjax(dcEventAccidentService.updateDcEventAccident(dcEventAccident)); } /** * 删除交通事故事件 */ @ApiOperation("删除交通事故事件") //@PreAuthorize("@ss.hasPermi('system:accident:remove')") @Log(title = "交通事故事件", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(dcEventAccidentService.deleteDcEventAccidentByIds(ids)); } }