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

/**
 * 水电站工程属性
 */
@RestController
@RequestMapping("/eng/attr/hyst")
public class AttEngHystController extends BaseController {

    @Autowired
    private IEngAttrService<AttEngHyst> hystEngAttrService;

    @GetMapping("/list")
    public TableDataInfo list(AttEngHyst attEngHyst) {
        startPage();
        List<AttEngHyst> list = hystEngAttrService.selectList(attEngHyst);
        return getDataTable(list);
    }

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

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

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

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