package com.goldenwater.slaj.acci.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.acci.domain.SawfSafeSupe;
import com.goldenwater.slaj.acci.service.ISawfSafeSupeService;

/**
 * 安全生产许可证信息
 */
@RestController
@RequestMapping("/acci/sawfsafesupe")
public class SawfSafeSupeController extends BaseController {
    @Autowired
    private ISawfSafeSupeService sawfSafeSupeService;

    @GetMapping("/list")
    public TableDataInfo list(SawfSafeSupe sawfSafeSupe) {
        startPage();
        List<SawfSafeSupe> list = sawfSafeSupeService.selectSawfSafeSupeList(sawfSafeSupe);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody SawfSafeSupe sawfSafeSupe) {
        return toAjax(sawfSafeSupeService.insertSawfSafeSupe(sawfSafeSupe));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody SawfSafeSupe sawfSafeSupe) {
        return toAjax(sawfSafeSupeService.updateSawfSafeSupe(sawfSafeSupe));
    }

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