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

/**
 * 巡查项
 */
@RestController
@RequestMapping("/hazard/tbusiinspectitem")
public class TBusiInspectItemController extends BaseController {
    @Autowired
    private ITBusiInspectItemService tBusiInspectItemService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiInspectItem tBusiInspectItem) {
        startPage();
        List<TBusiInspectItem> list = tBusiInspectItemService.selectTBusiInspectItemList(tBusiInspectItem);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiInspectItem tBusiInspectItem) {
        return toAjax(tBusiInspectItemService.insertTBusiInspectItem(tBusiInspectItem));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiInspectItem tBusiInspectItem) {
        return toAjax(tBusiInspectItemService.updateTBusiInspectItem(tBusiInspectItem));
    }

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