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

@RestController
@RequestMapping("/stan/fromfirsttria")
public class BisFromFirsttriaController extends BaseController {
    @Autowired
    private IBisFromFirsttriaService bisFromFirsttriaService;

    @GetMapping("/list")
    public TableDataInfo list(BisFromFirsttria bisFromFirsttria) { startPage(); List<BisFromFirsttria> list = bisFromFirsttriaService.selectBisFromFirsttriaList(bisFromFirsttria); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisFromFirsttria bisFromFirsttria) { return toAjax(bisFromFirsttriaService.insertBisFromFirsttria(bisFromFirsttria)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisFromFirsttria bisFromFirsttria) { return toAjax(bisFromFirsttriaService.updateBisFromFirsttria(bisFromFirsttria)); }

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

    @Log(title = "初审管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:fromfirsttria:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisFromFirsttria bisFromFirsttria) { List<BisFromFirsttria> list = bisFromFirsttriaService.selectBisFromFirsttriaList(bisFromFirsttria); ExcelUtil<BisFromFirsttria> util = new ExcelUtil<BisFromFirsttria>(BisFromFirsttria.class); util.exportExcel(response, list, "初审管理数据"); }
}
