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.MwrAcci;
import com.goldenwater.slaj.acci.service.IMwrAcciService;

/**
 * 水利部事故共享信息
 */
@RestController
@RequestMapping("/acci/mwracci")
public class MwrAcciController extends BaseController {
    @Autowired
    private IMwrAcciService mwrAcciService;

    @GetMapping("/list")
    public TableDataInfo list(MwrAcci mwrAcci) {
        startPage();
        List<MwrAcci> list = mwrAcciService.selectMwrAcciList(mwrAcci);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody MwrAcci mwrAcci) {
        return toAjax(mwrAcciService.insertMwrAcci(mwrAcci));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody MwrAcci mwrAcci) {
        return toAjax(mwrAcciService.updateMwrAcci(mwrAcci));
    }

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