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

/**
 * 危险源巡视记录
 */
@RestController
@RequestMapping("/hazard/bishazpatrec")
public class BisHazPatRecController extends BaseController {
    @Autowired
    private IBisHazPatRecService bisHazPatRecService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazPatRec bisHazPatRec) {
        startPage();
        List<BisHazPatRec> list = bisHazPatRecService.selectBisHazPatRecList(bisHazPatRec);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazPatRec bisHazPatRec) {
        return toAjax(bisHazPatRecService.insertBisHazPatRec(bisHazPatRec));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazPatRec bisHazPatRec) {
        return toAjax(bisHazPatRecService.updateBisHazPatRec(bisHazPatRec));
    }

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