package com.goldenwater.slaj.hidd.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.hidd.domain.ObjHidd;
import com.goldenwater.slaj.hidd.service.IObjHiddService;

/**
 * 隐患对象
 */
@RestController
@RequestMapping("/hidd/objhidd")
public class ObjHiddController extends BaseController {
    @Autowired
    private IObjHiddService objHiddService;

    @GetMapping("/list")
    public TableDataInfo list(ObjHidd objHidd) {
        startPage();
        List<ObjHidd> list = objHiddService.selectObjHiddList(objHidd);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody ObjHidd objHidd) {
        return toAjax(objHiddService.insertObjHidd(objHidd));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody ObjHidd objHidd) {
        return toAjax(objHiddService.updateObjHidd(objHidd));
    }

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