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

/**
 * 危险源风险预警评估
 */
@RestController
@RequestMapping("/hazard/tbusihazardwarm")
public class TBusiHazardWarmController extends BaseController {
    @Autowired
    private ITBusiHazardWarmService tBusiHazardWarmService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazardWarm tBusiHazardWarm) {
        startPage();
        List<TBusiHazardWarm> list = tBusiHazardWarmService.selectTBusiHazardWarmList(tBusiHazardWarm);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazardWarm tBusiHazardWarm) {
        return toAjax(tBusiHazardWarmService.insertTBusiHazardWarm(tBusiHazardWarm));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazardWarm tBusiHazardWarm) {
        return toAjax(tBusiHazardWarmService.updateTBusiHazardWarm(tBusiHazardWarm));
    }

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