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

/**
 * 重大危险源备案核销
 */
@RestController
@RequestMapping("/hazard/bishazmajregwrit")
public class BisHazMajRegWritController extends BaseController {
    @Autowired
    private IBisHazMajRegWritService bisHazMajRegWritService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazMajRegWrit bisHazMajRegWrit) {
        startPage();
        List<BisHazMajRegWrit> list = bisHazMajRegWritService.selectBisHazMajRegWritList(bisHazMajRegWrit);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazMajRegWrit bisHazMajRegWrit) {
        return toAjax(bisHazMajRegWritService.insertBisHazMajRegWrit(bisHazMajRegWrit));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazMajRegWrit bisHazMajRegWrit) {
        return toAjax(bisHazMajRegWritService.updateBisHazMajRegWrit(bisHazMajRegWrit));
    }

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