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

/**
 * 危险源对象表MW版
 */
@RestController
@RequestMapping("/hazard/objhazmw")
public class ObjHazMwController extends BaseController {
    @Autowired
    private IObjHazMwService objHazMwService;

    @GetMapping("/list")
    public TableDataInfo list(ObjHazMw objHazMw) {
        startPage();
        List<ObjHazMw> list = objHazMwService.selectObjHazMwList(objHazMw);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody ObjHazMw objHazMw) {
        return toAjax(objHazMwService.insertObjHazMw(objHazMw));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody ObjHazMw objHazMw) {
        return toAjax(objHazMwService.updateObjHazMw(objHazMw));
    }

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