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.BisHazAssess;
import com.goldenwater.slaj.hazard.service.IBisHazAssessService;

/**
 * 危险源考核
 */
@RestController
@RequestMapping("/hazard/bishazassess")
public class BisHazAssessController extends BaseController {
    @Autowired
    private IBisHazAssessService bisHazAssessService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazAssess bisHazAssess) {
        startPage();
        List<BisHazAssess> list = bisHazAssessService.selectBisHazAssessList(bisHazAssess);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazAssess bisHazAssess) {
        return toAjax(bisHazAssessService.insertBisHazAssess(bisHazAssess));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazAssess bisHazAssess) {
        return toAjax(bisHazAssessService.updateBisHazAssess(bisHazAssess));
    }

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