package com.goldenwater.slaj.hidd.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.hidd.domain.AttEngBase;
import com.goldenwater.slaj.hidd.service.IAttEngBaseService;

/**
 * 工程基础信息
 */
@RestController
@RequestMapping("/hidd/engbase")
public class AttEngBaseController extends BaseController {
    @Autowired
    private IAttEngBaseService attEngBaseService;

    @GetMapping("/list")
    public TableDataInfo list(AttEngBase attEngBase) {
        startPage();
        List<AttEngBase> list = attEngBaseService.selectAttEngBaseList(attEngBase);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody AttEngBase attEngBase) {
        return toAjax(attEngBaseService.insertAttEngBase(attEngBase));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody AttEngBase attEngBase) {
        return toAjax(attEngBaseService.updateAttEngBase(attEngBase));
    }

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