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

/**
 * 管控措施
 */
@RestController
@RequestMapping("/hazard/tbusicontrolmeasure")
public class TBusiControlMeasureController extends BaseController {
    @Autowired
    private ITBusiControlMeasureService tBusiControlMeasureService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiControlMeasure tBusiControlMeasure) {
        startPage();
        List<TBusiControlMeasure> list = tBusiControlMeasureService.selectTBusiControlMeasureList(tBusiControlMeasure);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiControlMeasure tBusiControlMeasure) {
        return toAjax(tBusiControlMeasureService.insertTBusiControlMeasure(tBusiControlMeasure));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiControlMeasure tBusiControlMeasure) {
        return toAjax(tBusiControlMeasureService.updateTBusiControlMeasure(tBusiControlMeasure));
    }

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