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

/**
 * 危险源UI统计
 */
@RestController
@RequestMapping("/hazard/tbusihazui")
public class TBusiHazUiController extends BaseController {
    @Autowired
    private ITBusiHazUiService tBusiHazUiService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazUi tBusiHazUi) {
        startPage();
        List<TBusiHazUi> list = tBusiHazUiService.selectTBusiHazUiList(tBusiHazUi);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazUi tBusiHazUi) {
        return toAjax(tBusiHazUiService.insertTBusiHazUi(tBusiHazUi));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazUi tBusiHazUi) {
        return toAjax(tBusiHazUiService.updateTBusiHazUi(tBusiHazUi));
    }

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