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

@RestController
@RequestMapping("/stan/scenrevi")
public class BisScenReviController extends BaseController {
    @Autowired
    private IBisScenReviService bisScenReviService;

    @GetMapping("/list")
    public TableDataInfo list(BisScenRevi bisScenRevi) { startPage(); List<BisScenRevi> list = bisScenReviService.selectBisScenReviList(bisScenRevi); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisScenRevi bisScenRevi) { return toAjax(bisScenReviService.insertBisScenRevi(bisScenRevi)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisScenRevi bisScenRevi) { return toAjax(bisScenReviService.updateBisScenRevi(bisScenRevi)); }

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

    @Log(title = "现场评审管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:scenrevi:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisScenRevi bisScenRevi) { List<BisScenRevi> list = bisScenReviService.selectBisScenReviList(bisScenRevi); ExcelUtil<BisScenRevi> util = new ExcelUtil<BisScenRevi>(BisScenRevi.class); util.exportExcel(response, list, "现场评审管理数据"); }
}
