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

/**
 * 泵站工程属性
 */
@RestController
@RequestMapping("/eng/attr/pust")
public class AttEngPustController extends BaseController {

    @Autowired
    private IEngAttrService<AttEngPust> pustEngAttrService;

    @GetMapping("/list")
    public TableDataInfo list(AttEngPust attEngPust) {
        startPage();
        List<AttEngPust> list = pustEngAttrService.selectList(attEngPust);
        return getDataTable(list);
    }

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

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

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

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