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

@RestController
@RequestMapping("/stan/objstanrevi")
public class ObjStanReviController extends BaseController {
    @Autowired
    private IObjStanReviService objStanReviService;

    @GetMapping("/list")
    public TableDataInfo list(ObjStanRevi objStanRevi) { startPage(); List<ObjStanRevi> list = objStanReviService.selectObjStanReviList(objStanRevi); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody ObjStanRevi objStanRevi) { return toAjax(objStanReviService.insertObjStanRevi(objStanRevi)); }

    @PutMapping
    public AjaxResult edit(@RequestBody ObjStanRevi objStanRevi) { return toAjax(objStanReviService.updateObjStanRevi(objStanRevi)); }

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

    @Log(title = "标准化评审对象管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:objstanrevi:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, ObjStanRevi objStanRevi) { List<ObjStanRevi> list = objStanReviService.selectObjStanReviList(objStanRevi); ExcelUtil<ObjStanRevi> util = new ExcelUtil<ObjStanRevi>(ObjStanRevi.class); util.exportExcel(response, list, "标准化评审对象管理数据"); }
}
