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

/**
 * 事故考核记录
 */
@RestController
@RequestMapping("/acci/bisacciassessrec")
public class BisAcciAssessRecController extends BaseController {
    @Autowired
    private IBisAcciAssessRecService bisAcciAssessRecService;

    @GetMapping("/list")
    public TableDataInfo list(BisAcciAssessRec bisAcciAssessRec) {
        startPage();
        List<BisAcciAssessRec> list = bisAcciAssessRecService.selectBisAcciAssessRecList(bisAcciAssessRec);
        return getDataTable(list);
    }

    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable Long id) {
        return AjaxResult.success(bisAcciAssessRecService.selectBisAcciAssessRecById(id));
    }

    @PostMapping
    public AjaxResult add(@RequestBody BisAcciAssessRec bisAcciAssessRec) {
        return toAjax(bisAcciAssessRecService.insertBisAcciAssessRec(bisAcciAssessRec));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisAcciAssessRec bisAcciAssessRec) {
        return toAjax(bisAcciAssessRecService.updateBisAcciAssessRec(bisAcciAssessRec));
    }

    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(bisAcciAssessRecService.deleteBisAcciAssessRecByIds(ids));
    }
}
