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

/**
 * 危险源统计
 */
@RestController
@RequestMapping("/hazard/tbusihazcount")
public class TBusiHazCountController extends BaseController {
    @Autowired
    private ITBusiHazCountService tBusiHazCountService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazCount tBusiHazCount) {
        startPage();
        List<TBusiHazCount> list = tBusiHazCountService.selectTBusiHazCountList(tBusiHazCount);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazCount tBusiHazCount) {
        return toAjax(tBusiHazCountService.insertTBusiHazCount(tBusiHazCount));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazCount tBusiHazCount) {
        return toAjax(tBusiHazCountService.updateTBusiHazCount(tBusiHazCount));
    }

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