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

@RestController
@RequestMapping("/stan/stanselfevarep")
public class BisStanSelfEvaRepController extends BaseController {
    @Autowired
    private IBisStanSelfEvaRepService bisStanSelfEvaRepService;

    @GetMapping("/list")
    public TableDataInfo list(BisStanSelfEvaRep bisStanSelfEvaRep) { startPage(); List<BisStanSelfEvaRep> list = bisStanSelfEvaRepService.selectBisStanSelfEvaRepList(bisStanSelfEvaRep); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisStanSelfEvaRep bisStanSelfEvaRep) { return toAjax(bisStanSelfEvaRepService.insertBisStanSelfEvaRep(bisStanSelfEvaRep)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisStanSelfEvaRep bisStanSelfEvaRep) { return toAjax(bisStanSelfEvaRepService.updateBisStanSelfEvaRep(bisStanSelfEvaRep)); }

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

    @Log(title = "标准化自评报告管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:stanselfevarep:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisStanSelfEvaRep bisStanSelfEvaRep) { List<BisStanSelfEvaRep> list = bisStanSelfEvaRepService.selectBisStanSelfEvaRepList(bisStanSelfEvaRep); ExcelUtil<BisStanSelfEvaRep> util = new ExcelUtil<BisStanSelfEvaRep>(BisStanSelfEvaRep.class); util.exportExcel(response, list, "标准化自评报告管理数据"); }
}
