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

/**
 * 水利信用事故
 */
@RestController
@RequestMapping("/acci/mwrcredacci")
public class MwrCredAcciController extends BaseController {
    @Autowired
    private IMwrCredAcciService mwrCredAcciService;

    @GetMapping("/list")
    public TableDataInfo list(MwrCredAcci mwrCredAcci) {
        startPage();
        List<MwrCredAcci> list = mwrCredAcciService.selectMwrCredAcciList(mwrCredAcci);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody MwrCredAcci mwrCredAcci) {
        return toAjax(mwrCredAcciService.insertMwrCredAcci(mwrCredAcci));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody MwrCredAcci mwrCredAcci) {
        return toAjax(mwrCredAcciService.updateMwrCredAcci(mwrCredAcci));
    }

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