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

/**
 * 巡查记录
 */
@RestController
@RequestMapping("/hazard/tbusiinspectrecord")
public class TBusiInspectRecordController extends BaseController {
    @Autowired
    private ITBusiInspectRecordService tBusiInspectRecordService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiInspectRecord tBusiInspectRecord) {
        startPage();
        List<TBusiInspectRecord> list = tBusiInspectRecordService.selectTBusiInspectRecordList(tBusiInspectRecord);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiInspectRecord tBusiInspectRecord) {
        return toAjax(tBusiInspectRecordService.insertTBusiInspectRecord(tBusiInspectRecord));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiInspectRecord tBusiInspectRecord) {
        return toAjax(tBusiInspectRecordService.updateTBusiInspectRecord(tBusiInspectRecord));
    }

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