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

/**
 * 危险源安全生产评价
 */
@RestController
@RequestMapping("/hazard/tbusihazeva")
public class TBusiHazEvaController extends BaseController {
    @Autowired
    private ITBusiHazEvaService tBusiHazEvaService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazEva tBusiHazEva) {
        startPage();
        List<TBusiHazEva> list = tBusiHazEvaService.selectTBusiHazEvaList(tBusiHazEva);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazEva tBusiHazEva) {
        return toAjax(tBusiHazEvaService.insertTBusiHazEva(tBusiHazEva));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazEva tBusiHazEva) {
        return toAjax(tBusiHazEvaService.updateTBusiHazEva(tBusiHazEva));
    }

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