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

/**
 * 事故快报
 */
@RestController
@RequestMapping("/acci/bisacciexprep")
public class BisAcciExpRepController extends BaseController {
    @Autowired
    private IBisAcciExpRepService bisAcciExpRepService;

    @GetMapping("/list")
    public TableDataInfo list(BisAcciExpRep bisAcciExpRep) {
        startPage();
        List<BisAcciExpRep> list = bisAcciExpRepService.selectBisAcciExpRepList(bisAcciExpRep);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisAcciExpRep bisAcciExpRep) {
        return toAjax(bisAcciExpRepService.insertBisAcciExpRep(bisAcciExpRep));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisAcciExpRep bisAcciExpRep) {
        return toAjax(bisAcciExpRepService.updateBisAcciExpRep(bisAcciExpRep));
    }

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