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

/**
 * 危化品入库记录
 */
@RestController
@RequestMapping("/hazard/bishachrecrep")
public class BisHachRecRepController extends BaseController {
    @Autowired
    private IBisHachRecRepService bisHachRecRepService;

    @GetMapping("/list")
    public TableDataInfo list(BisHachRecRep bisHachRecRep) {
        startPage();
        List<BisHachRecRep> list = bisHachRecRepService.selectBisHachRecRepList(bisHachRecRep);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHachRecRep bisHachRecRep) {
        return toAjax(bisHachRecRepService.insertBisHachRecRep(bisHachRecRep));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHachRecRep bisHachRecRep) {
        return toAjax(bisHachRecRepService.updateBisHachRecRep(bisHachRecRep));
    }

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