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

/**
 * 巡查任务
 */
@RestController
@RequestMapping("/hazard/tbusiinspecttask")
public class TBusiInspectTaskController extends BaseController {
    @Autowired
    private ITBusiInspectTaskService tBusiInspectTaskService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiInspectTask tBusiInspectTask) {
        startPage();
        List<TBusiInspectTask> list = tBusiInspectTaskService.selectTBusiInspectTaskList(tBusiInspectTask);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiInspectTask tBusiInspectTask) {
        return toAjax(tBusiInspectTaskService.insertTBusiInspectTask(tBusiInspectTask));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiInspectTask tBusiInspectTask) {
        return toAjax(tBusiInspectTaskService.updateTBusiInspectTask(tBusiInspectTask));
    }

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