package com.goldenwater.slaj.stan.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.goldenwater.common.annotation.Log;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.common.core.page.TableDataInfo;
import com.goldenwater.common.enums.BusinessType;
import com.goldenwater.common.utils.poi.ExcelUtil;
import com.goldenwater.slaj.stan.domain.ObjStanAppl;
import com.goldenwater.slaj.stan.service.IObjStanApplService;

@RestController
@RequestMapping("/stan/objstanappl")
public class ObjStanApplController extends BaseController {
    @Autowired
    private IObjStanApplService objStanApplService;

    @GetMapping("/list")
    public TableDataInfo list(ObjStanAppl objStanAppl) { startPage(); List<ObjStanAppl> list = objStanApplService.selectObjStanApplList(objStanAppl); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody ObjStanAppl objStanAppl) { return toAjax(objStanApplService.insertObjStanAppl(objStanAppl)); }

    @PutMapping
    public AjaxResult edit(@RequestBody ObjStanAppl objStanAppl) { return toAjax(objStanApplService.updateObjStanAppl(objStanAppl)); }

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

    @Log(title = "标准化申请管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:objstanappl:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, ObjStanAppl objStanAppl) { List<ObjStanAppl> list = objStanApplService.selectObjStanApplList(objStanAppl); ExcelUtil<ObjStanAppl> util = new ExcelUtil<ObjStanAppl>(ObjStanAppl.class); util.exportExcel(response, list, "标准化申请管理数据"); }
}
