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

/**
 * 事故月报
 */
@RestController
@RequestMapping("/acci/bisaccimont")
public class BisAcciMontController extends BaseController {
    @Autowired
    private IBisAcciMontService bisAcciMontService;

    @GetMapping("/list")
    public TableDataInfo list(BisAcciMont bisAcciMont) {
        startPage();
        List<BisAcciMont> list = bisAcciMontService.selectBisAcciMontList(bisAcciMont);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisAcciMont bisAcciMont) {
        return toAjax(bisAcciMontService.insertBisAcciMont(bisAcciMont));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisAcciMont bisAcciMont) {
        return toAjax(bisAcciMontService.updateBisAcciMont(bisAcciMont));
    }

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