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

/**
 * 事故进展
 */
@RestController
@RequestMapping("/acci/bisacciprog")
public class BisAcciProgController extends BaseController {
    @Autowired
    private IBisAcciProgService bisAcciProgService;

    @GetMapping("/list")
    public TableDataInfo list(BisAcciProg bisAcciProg) {
        startPage();
        List<BisAcciProg> list = bisAcciProgService.selectBisAcciProgList(bisAcciProg);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisAcciProg bisAcciProg) {
        return toAjax(bisAcciProgService.insertBisAcciProg(bisAcciProg));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisAcciProg bisAcciProg) {
        return toAjax(bisAcciProgService.updateBisAcciProg(bisAcciProg));
    }

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