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

@RestController
@RequestMapping("/sins/relsinsgrouptoexpe")
public class RelSinsGroupToExpeController extends BaseController {
    @Autowired
    private IRelSinsGroupToExpeService relSinsGroupToExpeService;

    @GetMapping("/list")
    public TableDataInfo list(RelSinsGroupToExpe relSinsGroupToExpe) { startPage(); List<RelSinsGroupToExpe> list = relSinsGroupToExpeService.selectRelSinsGroupToExpeList(relSinsGroupToExpe); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody RelSinsGroupToExpe relSinsGroupToExpe) { return toAjax(relSinsGroupToExpeService.insertRelSinsGroupToExpe(relSinsGroupToExpe)); }

    @PutMapping
    public AjaxResult edit(@RequestBody RelSinsGroupToExpe relSinsGroupToExpe) { return toAjax(relSinsGroupToExpeService.updateRelSinsGroupToExpe(relSinsGroupToExpe)); }

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

    @Log(title = "检查组专家关联管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('sins:relsinsgrouptoexpe:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, RelSinsGroupToExpe relSinsGroupToExpe) { List<RelSinsGroupToExpe> list = relSinsGroupToExpeService.selectRelSinsGroupToExpeList(relSinsGroupToExpe); ExcelUtil<RelSinsGroupToExpe> util = new ExcelUtil<RelSinsGroupToExpe>(RelSinsGroupToExpe.class); util.exportExcel(response, list, "检查组专家关联管理数据"); }
}
