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

/**
 * 备案核销机构关联
 */
@RestController
@RequestMapping("/hazard/bishazmajregwritregorg")
public class BisHazMajRegWritRegorgController extends BaseController {
    @Autowired
    private IBisHazMajRegWritRegorgService bisHazMajRegWritRegorgService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazMajRegWritRegorg bisHazMajRegWritRegorg) {
        startPage();
        List<BisHazMajRegWritRegorg> list = bisHazMajRegWritRegorgService.selectBisHazMajRegWritRegorgList(bisHazMajRegWritRegorg);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazMajRegWritRegorg bisHazMajRegWritRegorg) {
        return toAjax(bisHazMajRegWritRegorgService.insertBisHazMajRegWritRegorg(bisHazMajRegWritRegorg));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazMajRegWritRegorg bisHazMajRegWritRegorg) {
        return toAjax(bisHazMajRegWritRegorgService.updateBisHazMajRegWritRegorg(bisHazMajRegWritRegorg));
    }

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