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

/**
 * 备案核销新版本
 */
@RestController
@RequestMapping("/hazard/bishazmajregwritnew")
public class BisHazMajRegWritNewController extends BaseController {
    @Autowired
    private IBisHazMajRegWritNewService bisHazMajRegWritNewService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazMajRegWritNew bisHazMajRegWritNew) {
        startPage();
        List<BisHazMajRegWritNew> list = bisHazMajRegWritNewService.selectBisHazMajRegWritNewList(bisHazMajRegWritNew);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisHazMajRegWritNew bisHazMajRegWritNew) {
        return toAjax(bisHazMajRegWritNewService.insertBisHazMajRegWritNew(bisHazMajRegWritNew));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazMajRegWritNew bisHazMajRegWritNew) {
        return toAjax(bisHazMajRegWritNewService.updateBisHazMajRegWritNew(bisHazMajRegWritNew));
    }

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