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

/**
 * 管控条件
 */
@RestController
@RequestMapping("/hazard/tbusicontrolterm")
public class TBusiControlTermController extends BaseController {
    @Autowired
    private ITBusiControlTermService tBusiControlTermService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiControlTerm tBusiControlTerm) {
        startPage();
        List<TBusiControlTerm> list = tBusiControlTermService.selectTBusiControlTermList(tBusiControlTerm);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiControlTerm tBusiControlTerm) {
        return toAjax(tBusiControlTermService.insertTBusiControlTerm(tBusiControlTerm));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiControlTerm tBusiControlTerm) {
        return toAjax(tBusiControlTermService.updateTBusiControlTerm(tBusiControlTerm));
    }

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