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.RelSblzConfig;
import com.goldenwater.slaj.sins.service.IRelSblzConfigService;

@RestController
@RequestMapping("/sins/relsblzconfig")
public class RelSblzConfigController extends BaseController {
    @Autowired
    private IRelSblzConfigService relSblzConfigService;

    @GetMapping("/list")
    public TableDataInfo list(RelSblzConfig relSblzConfig) { startPage(); List<RelSblzConfig> list = relSblzConfigService.selectRelSblzConfigList(relSblzConfig); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody RelSblzConfig relSblzConfig) { return toAjax(relSblzConfigService.insertRelSblzConfig(relSblzConfig)); }

    @PutMapping
    public AjaxResult edit(@RequestBody RelSblzConfig relSblzConfig) { return toAjax(relSblzConfigService.updateRelSblzConfig(relSblzConfig)); }

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

    @Log(title = "SBLZ配置管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('sins:relsblzconfig:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, RelSblzConfig relSblzConfig) { List<RelSblzConfig> list = relSblzConfigService.selectRelSblzConfigList(relSblzConfig); ExcelUtil<RelSblzConfig> util = new ExcelUtil<RelSblzConfig>(RelSblzConfig.class); util.exportExcel(response, list, "SBLZ配置管理数据"); }
}
