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

/**
 * 危化品入库
 */
@RestController
@RequestMapping("/hazard/bishachstor")
public class BisHachStorController extends BaseController {
    @Autowired
    private IBisHachStorService bisHachStorService;

    @GetMapping("/list")
    public TableDataInfo list(BisHachStor bisHachStor) {
        startPage();
        List<BisHachStor> list = bisHachStorService.selectBisHachStorList(bisHachStor);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHachStor bisHachStor) {
        return toAjax(bisHachStorService.insertBisHachStor(bisHachStor));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHachStor bisHachStor) {
        return toAjax(bisHachStorService.updateBisHachStor(bisHachStor));
    }

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