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

/**
 * 危化品出库
 */
@RestController
@RequestMapping("/hazard/bishachdel")
public class BisHachDelController extends BaseController {
    @Autowired
    private IBisHachDelService bisHachDelService;

    @GetMapping("/list")
    public TableDataInfo list(BisHachDel bisHachDel) {
        startPage();
        List<BisHachDel> list = bisHachDelService.selectBisHachDelList(bisHachDel);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHachDel bisHachDel) {
        return toAjax(bisHachDelService.insertBisHachDel(bisHachDel));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHachDel bisHachDel) {
        return toAjax(bisHachDelService.updateBisHachDel(bisHachDel));
    }

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