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

/**
 * 危化品对象
 */
@RestController
@RequestMapping("/hazard/objhach")
public class ObjHachController extends BaseController {
    @Autowired
    private IObjHachService objHachService;

    @GetMapping("/list")
    public TableDataInfo list(ObjHach objHach) {
        startPage();
        List<ObjHach> list = objHachService.selectObjHachList(objHach);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody ObjHach objHach) {
        return toAjax(objHachService.insertObjHach(objHach));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody ObjHach objHach) {
        return toAjax(objHachService.updateObjHach(objHach));
    }

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