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

@RestController
@RequestMapping("/stan/stancertchaappl")
public class BisStanCertChaApplController extends BaseController {
    @Autowired
    private IBisStanCertChaApplService bisStanCertChaApplService;

    @GetMapping("/list")
    public TableDataInfo list(BisStanCertChaAppl bisStanCertChaAppl) { startPage(); List<BisStanCertChaAppl> list = bisStanCertChaApplService.selectBisStanCertChaApplList(bisStanCertChaAppl); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisStanCertChaAppl bisStanCertChaAppl) { return toAjax(bisStanCertChaApplService.insertBisStanCertChaAppl(bisStanCertChaAppl)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisStanCertChaAppl bisStanCertChaAppl) { return toAjax(bisStanCertChaApplService.updateBisStanCertChaAppl(bisStanCertChaAppl)); }

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

    @Log(title = "证书变更申请管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:stancertchaappl:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisStanCertChaAppl bisStanCertChaAppl) { List<BisStanCertChaAppl> list = bisStanCertChaApplService.selectBisStanCertChaApplList(bisStanCertChaAppl); ExcelUtil<BisStanCertChaAppl> util = new ExcelUtil<BisStanCertChaAppl>(BisStanCertChaAppl.class); util.exportExcel(response, list, "证书变更申请管理数据"); }
}
