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

/**
 * 堤防工程属性
 */
@RestController
@RequestMapping("/eng/attr/dike")
public class AttEngDikeController extends BaseController {

    @Autowired
    private IEngAttrService<AttEngDike> dikeEngAttrService;

    @GetMapping("/list")
    public TableDataInfo list(AttEngDike attEngDike) {
        startPage();
        List<AttEngDike> list = dikeEngAttrService.selectList(attEngDike);
        return getDataTable(list);
    }

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

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

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

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