package com.goldenwater.slaj.sins.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.sins.domain.BisSinsReport;
import com.goldenwater.slaj.sins.service.IBisSinsReportService;

@RestController
@RequestMapping("/sins/sinsreport")
public class BisSinsReportController extends BaseController {
    @Autowired
    private IBisSinsReportService bisSinsReportService;

    @GetMapping("/list")
    public TableDataInfo list(BisSinsReport bisSinsReport) { startPage(); List<BisSinsReport> list = bisSinsReportService.selectBisSinsReportList(bisSinsReport); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisSinsReport bisSinsReport) { return toAjax(bisSinsReportService.insertBisSinsReport(bisSinsReport)); }

    @PutMapping
    public AjaxResult edit(@RequestBody BisSinsReport bisSinsReport) { return toAjax(bisSinsReportService.updateBisSinsReport(bisSinsReport)); }

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

    @Log(title = "检查报告管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('sins:sinsreport:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, BisSinsReport bisSinsReport) { List<BisSinsReport> list = bisSinsReportService.selectBisSinsReportList(bisSinsReport); ExcelUtil<BisSinsReport> util = new ExcelUtil<BisSinsReport>(BisSinsReport.class); util.exportExcel(response, list, "检查报告管理数据"); }
}
