package com.goldenwater.slaj.acci.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.common.core.page.TableDataInfo;
import com.goldenwater.slaj.acci.domain.BisAcciRep;
import com.goldenwater.slaj.acci.service.IBisAcciRepService;

/**
 * 事故报告
 */
@RestController
@RequestMapping("/acci/bisaccirep")
public class BisAcciRepController extends BaseController {
    @Autowired
    private IBisAcciRepService bisAcciRepService;

    @GetMapping("/list")
    public TableDataInfo list(BisAcciRep bisAcciRep) {
        startPage();
        List<BisAcciRep> list = bisAcciRepService.selectBisAcciRepList(bisAcciRep);
        return getDataTable(list);
    }

    @GetMapping("/{guid}")
    public AjaxResult getInfo(@PathVariable String guid) {
        return AjaxResult.success(bisAcciRepService.selectBisAcciRepByGuid(guid));
    }

    @PostMapping
    public AjaxResult add(@RequestBody BisAcciRep bisAcciRep) {
        return toAjax(bisAcciRepService.insertBisAcciRep(bisAcciRep));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisAcciRep bisAcciRep) {
        return toAjax(bisAcciRepService.updateBisAcciRep(bisAcciRep));
    }

    @DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids) {
        return toAjax(bisAcciRepService.deleteBisAcciRepByGuids(guids));
    }
}
