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

/**
 * 风险阈值
 */
@RestController
@RequestMapping("/hazard/tbusiriskthreshold")
public class TBusiRiskThresholdController extends BaseController {
    @Autowired
    private ITBusiRiskThresholdService tBusiRiskThresholdService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiRiskThreshold tBusiRiskThreshold) {
        startPage();
        List<TBusiRiskThreshold> list = tBusiRiskThresholdService.selectTBusiRiskThresholdList(tBusiRiskThreshold);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiRiskThreshold tBusiRiskThreshold) {
        return toAjax(tBusiRiskThresholdService.insertTBusiRiskThreshold(tBusiRiskThreshold));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiRiskThreshold tBusiRiskThreshold) {
        return toAjax(tBusiRiskThresholdService.updateTBusiRiskThreshold(tBusiRiskThreshold));
    }

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