package com.ruoyi.model.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.model.domain.IndexPartnerConfig;
import com.ruoyi.model.service.IIndexPartnerConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 加入合伙人提示配置Controller
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@RestController
@RequestMapping("/model/indexPartnerConfig")
public class IndexPartnerConfigController extends BaseController
{
    @Autowired
    private IIndexPartnerConfigService indexPartnerConfigService;

    /**
     * 查询加入合伙人提示配置列表
     */
    @PreAuthorize("@ss.hasPermi('model:indexPartnerConfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(IndexPartnerConfig indexPartnerConfig)
    {
        startPage();
        List<IndexPartnerConfig> list = indexPartnerConfigService.selectIndexPartnerConfigList(indexPartnerConfig);
        return getDataTable(list);
    }

    /**
     * 导出加入合伙人提示配置列表
     */
    @PreAuthorize("@ss.hasPermi('model:indexPartnerConfig:export')")
    @Log(title = "加入合伙人提示配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IndexPartnerConfig indexPartnerConfig) throws IOException {
        List<IndexPartnerConfig> list = indexPartnerConfigService.selectIndexPartnerConfigList(indexPartnerConfig);
        ExcelUtil<IndexPartnerConfig> util = new ExcelUtil<IndexPartnerConfig>(IndexPartnerConfig.class);
        util.exportExcel(response, list, "加入合伙人提示配置数据");
    }

    /**
     * 获取加入合伙人提示配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('model:indexPartnerConfig:query')")
    @GetMapping(value = "/{partnerBackground}")
    public AjaxResult getInfo(@PathVariable("partnerBackground") String partnerBackground)
    {
        return success(indexPartnerConfigService.selectIndexPartnerConfigByPartnerBackground(partnerBackground));
    }

    /**
     * 新增加入合伙人提示配置
     */
    @PreAuthorize("@ss.hasPermi('model:indexPartnerConfig:add')")
    @Log(title = "加入合伙人提示配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody IndexPartnerConfig indexPartnerConfig)
    {
        return toAjax(indexPartnerConfigService.insertIndexPartnerConfig(indexPartnerConfig));
    }

    /**
     * 修改加入合伙人提示配置
     */
    @PreAuthorize("@ss.hasPermi('model:indexPartnerConfig:edit')")
    @Log(title = "加入合伙人提示配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody IndexPartnerConfig indexPartnerConfig)
    {
        return toAjax(indexPartnerConfigService.updateIndexPartnerConfig(indexPartnerConfig));
    }

    /**
     * 删除加入合伙人提示配置
     */
    @PreAuthorize("@ss.hasPermi('model:indexPartnerConfig:remove')")
    @Log(title = "加入合伙人提示配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{partnerBackgrounds}")
    public AjaxResult remove(@PathVariable String[] partnerBackgrounds)
    {
        return toAjax(indexPartnerConfigService.deleteIndexPartnerConfigByPartnerBackgrounds(partnerBackgrounds));
    }
}
