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

/**
 * 危险源档案
 */
@RestController
@RequestMapping("/hazard/tbusihazardarchive")
public class TBusiHazardArchiveController extends BaseController {
    @Autowired
    private ITBusiHazardArchiveService tBusiHazardArchiveService;

    @GetMapping("/list")
    public TableDataInfo list(TBusiHazardArchive tBusiHazardArchive) {
        startPage();
        List<TBusiHazardArchive> list = tBusiHazardArchiveService.selectTBusiHazardArchiveList(tBusiHazardArchive);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TBusiHazardArchive tBusiHazardArchive) {
        return toAjax(tBusiHazardArchiveService.insertTBusiHazardArchive(tBusiHazardArchive));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TBusiHazardArchive tBusiHazardArchive) {
        return toAjax(tBusiHazardArchiveService.updateTBusiHazardArchive(tBusiHazardArchive));
    }

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