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

@RestController
@RequestMapping("/stan/stanscore")
public class BisStanScoreController extends BaseController {
    @Autowired
    private IBisStanScoreService bisStanScoreService;

    @GetMapping("/list")
    public TableDataInfo list(BisStanScore bisStanScore) { startPage(); List<BisStanScore> list = bisStanScoreService.selectBisStanScoreList(bisStanScore); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisStanScore bisStanScore) { return toAjax(bisStanScoreService.insertBisStanScore(bisStanScore)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisStanScore bisStanScore) { return toAjax(bisStanScoreService.updateBisStanScore(bisStanScore)); }

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

    @Log(title = "标准化评分管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('stan:stanscore:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisStanScore bisStanScore) { List<BisStanScore> list = bisStanScoreService.selectBisStanScoreList(bisStanScore); ExcelUtil<BisStanScore> util = new ExcelUtil<BisStanScore>(BisStanScore.class); util.exportExcel(response, list, "标准化评分管理数据"); }
}
