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.BisAcciInve;
import com.goldenwater.slaj.acci.service.IBisAcciInveService;

/**
 * 事故调查
 */
@RestController
@RequestMapping("/acci/bisacciinve")
public class BisAcciInveController extends BaseController {
    @Autowired
    private IBisAcciInveService bisAcciInveService;

    @GetMapping("/list")
    public TableDataInfo list(BisAcciInve bisAcciInve) {
        startPage();
        List<BisAcciInve> list = bisAcciInveService.selectBisAcciInveList(bisAcciInve);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisAcciInve bisAcciInve) {
        return toAjax(bisAcciInveService.insertBisAcciInve(bisAcciInve));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisAcciInve bisAcciInve) {
        return toAjax(bisAcciInveService.updateBisAcciInve(bisAcciInve));
    }

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