package com.goldenwater.slaj.eng.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.eng.domain.AttEngSd;
import com.goldenwater.slaj.eng.service.IEngAttrService;

/**
 * 淤地坝工程属性
 */
@RestController
@RequestMapping("/eng/attr/sd")
public class AttEngSdController extends BaseController {

    @Autowired
    private IEngAttrService<AttEngSd> sdEngAttrService;

    @GetMapping("/list")
    public TableDataInfo list(AttEngSd attEngSd) {
        startPage();
        List<AttEngSd> list = sdEngAttrService.selectList(attEngSd);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody AttEngSd entity) {
        return toAjax(sdEngAttrService.insert(entity));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody AttEngSd entity) {
        return toAjax(sdEngAttrService.update(entity));
    }

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