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

/**
 * 危险源月度统计
 */
@RestController
@RequestMapping("/hazard/tbusihazcountmon")
public class TBusiHazCountMonController extends BaseController {
    @Autowired
    private ITBusiHazCountMonService tBusiHazCountMonService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazCountMon tBusiHazCountMon) {
        startPage();
        List<TBusiHazCountMon> list = tBusiHazCountMonService.selectTBusiHazCountMonList(tBusiHazCountMon);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazCountMon tBusiHazCountMon) {
        return toAjax(tBusiHazCountMonService.insertTBusiHazCountMon(tBusiHazCountMon));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazCountMon tBusiHazCountMon) {
        return toAjax(tBusiHazCountMonService.updateTBusiHazCountMon(tBusiHazCountMon));
    }

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