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

@RestController
@RequestMapping("/sins/relsinsgrouptopers")
public class RelSinsGroupToPersController extends BaseController {
    @Autowired
    private IRelSinsGroupToPersService relSinsGroupToPersService;

    @GetMapping("/list")
    public TableDataInfo list(RelSinsGroupToPers relSinsGroupToPers) { startPage(); List<RelSinsGroupToPers> list = relSinsGroupToPersService.selectRelSinsGroupToPersList(relSinsGroupToPers); return getDataTable(list); }

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

    @PostMapping
    public AjaxResult add(@RequestBody RelSinsGroupToPers relSinsGroupToPers) { return toAjax(relSinsGroupToPersService.insertRelSinsGroupToPers(relSinsGroupToPers)); }

    @PutMapping
    public AjaxResult edit(@RequestBody RelSinsGroupToPers relSinsGroupToPers) { return toAjax(relSinsGroupToPersService.updateRelSinsGroupToPers(relSinsGroupToPers)); }

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

    @Log(title = "检查组人员关联管理", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('sins:relsinsgrouptopers:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, RelSinsGroupToPers relSinsGroupToPers) { List<RelSinsGroupToPers> list = relSinsGroupToPersService.selectRelSinsGroupToPersList(relSinsGroupToPers); ExcelUtil<RelSinsGroupToPers> util = new ExcelUtil<RelSinsGroupToPers>(RelSinsGroupToPers.class); util.exportExcel(response, list, "检查组人员关联管理数据"); }
}
