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.BisStanCertExtAppl;
import com.goldenwater.slaj.stan.service.IBisStanCertExtApplService;

@RestController
@RequestMapping("/stan/stancertextappl")
public class BisStanCertExtApplController extends BaseController {
    @Autowired
    private IBisStanCertExtApplService bisStanCertExtApplService;

    @GetMapping("/list")
    public TableDataInfo list(BisStanCertExtAppl bisStanCertExtAppl) { startPage(); List<BisStanCertExtAppl> list = bisStanCertExtApplService.selectBisStanCertExtApplList(bisStanCertExtAppl); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisStanCertExtAppl bisStanCertExtAppl) { return toAjax(bisStanCertExtApplService.insertBisStanCertExtAppl(bisStanCertExtAppl)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisStanCertExtAppl bisStanCertExtAppl) { return toAjax(bisStanCertExtApplService.updateBisStanCertExtAppl(bisStanCertExtAppl)); }

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

    @Log(title = "证书延期申请管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:stancertextappl:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisStanCertExtAppl bisStanCertExtAppl) { List<BisStanCertExtAppl> list = bisStanCertExtApplService.selectBisStanCertExtApplList(bisStanCertExtAppl); ExcelUtil<BisStanCertExtAppl> util = new ExcelUtil<BisStanCertExtAppl>(BisStanCertExtAppl.class); util.exportExcel(response, list, "证书延期申请管理数据"); }
}
