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

/**
 * 危险源辨识表
 */
@RestController
@RequestMapping("/hazard/tbusihaziden")
public class TBusiHazIdenController extends BaseController {
    @Autowired
    private ITBusiHazIdenService tBusiHazIdenService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazIden tBusiHazIden) {
        startPage();
        List<TBusiHazIden> list = tBusiHazIdenService.selectTBusiHazIdenList(tBusiHazIden);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazIden tBusiHazIden) {
        return toAjax(tBusiHazIdenService.insertTBusiHazIden(tBusiHazIden));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazIden tBusiHazIden) {
        return toAjax(tBusiHazIdenService.updateTBusiHazIden(tBusiHazIden));
    }

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