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

/**
 * 巡查任务项
 */
@RestController
@RequestMapping("/hazard/tbusiinspecttaskitem")
public class TBusiInspectTaskItemController extends BaseController {
    @Autowired
    private ITBusiInspectTaskItemService tBusiInspectTaskItemService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiInspectTaskItem tBusiInspectTaskItem) {
        startPage();
        List<TBusiInspectTaskItem> list = tBusiInspectTaskItemService.selectTBusiInspectTaskItemList(tBusiInspectTaskItem);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiInspectTaskItem tBusiInspectTaskItem) {
        return toAjax(tBusiInspectTaskItemService.insertTBusiInspectTaskItem(tBusiInspectTaskItem));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiInspectTaskItem tBusiInspectTaskItem) {
        return toAjax(tBusiInspectTaskItemService.updateTBusiInspectTaskItem(tBusiInspectTaskItem));
    }

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