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.AttOrgBase;
import com.goldenwater.slaj.hidd.service.IAttOrgBaseService;

@RestController
@RequestMapping("/hidd/orgbase")
public class AttOrgBaseController extends BaseController {
    @Autowired
    private IAttOrgBaseService attOrgBaseService;

    @GetMapping("/list")
    public TableDataInfo list(AttOrgBase attOrgBase) {
        startPage();
        List<AttOrgBase> list = attOrgBaseService.selectAttOrgBaseList(attOrgBase);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody AttOrgBase attOrgBase) {
        return toAjax(attOrgBaseService.insertAttOrgBase(attOrgBase));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody AttOrgBase attOrgBase) {
        return toAjax(attOrgBaseService.updateAttOrgBase(attOrgBase));
    }

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