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

/**
 * 危险源评价内部
 */
@RestController
@RequestMapping("/hazard/tbusihazevain")
public class TBusiHazEvainController extends BaseController {
    @Autowired
    private ITBusiHazEvainService tBusiHazEvainService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazEvain tBusiHazEvain) {
        startPage();
        List<TBusiHazEvain> list = tBusiHazEvainService.selectTBusiHazEvainList(tBusiHazEvain);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazEvain tBusiHazEvain) {
        return toAjax(tBusiHazEvainService.insertTBusiHazEvain(tBusiHazEvain));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazEvain tBusiHazEvain) {
        return toAjax(tBusiHazEvainService.updateTBusiHazEvain(tBusiHazEvain));
    }

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