package com.goldenwater.slaj.hazard.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.hazard.domain.BisHazAssessRec;
import com.goldenwater.slaj.hazard.service.IBisHazAssessRecService;

/**
 * 危险源考核记录
 */
@RestController
@RequestMapping("/hazard/bishazassessrec")
public class BisHazAssessRecController extends BaseController {
    @Autowired
    private IBisHazAssessRecService bisHazAssessRecService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazAssessRec bisHazAssessRec) {
        startPage();
        List<BisHazAssessRec> list = bisHazAssessRecService.selectBisHazAssessRecList(bisHazAssessRec);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazAssessRec bisHazAssessRec) {
        return toAjax(bisHazAssessRecService.insertBisHazAssessRec(bisHazAssessRec));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazAssessRec bisHazAssessRec) {
        return toAjax(bisHazAssessRecService.updateBisHazAssessRec(bisHazAssessRec));
    }

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