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

/**
 * 危险源辨识评价
 */
@RestController
@RequestMapping("/hazard/bishazideneva")
public class BisHazIdenEvaController extends BaseController {
    @Autowired
    private IBisHazIdenEvaService bisHazIdenEvaService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazIdenEva bisHazIdenEva) {
        startPage();
        List<BisHazIdenEva> list = bisHazIdenEvaService.selectBisHazIdenEvaList(bisHazIdenEva);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazIdenEva bisHazIdenEva) {
        return toAjax(bisHazIdenEvaService.insertBisHazIdenEva(bisHazIdenEva));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazIdenEva bisHazIdenEva) {
        return toAjax(bisHazIdenEvaService.updateBisHazIdenEva(bisHazIdenEva));
    }

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