package com.ruoyi.base.controller;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.base.domain.BaseInquiry;
import com.ruoyi.base.service.IBaseInquiryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 在线询盘设置Controller
 * 
 * @author vinjor-m
 * @date 2025-06-24
 */
@RestController
@RequestMapping("/base/inquiry")
public class BaseInquiryController extends BaseController
{
    @Autowired
    private IBaseInquiryService baseInquiryService;

    /**
     * 获取在线询盘设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('base:inquiry:query')")
    @GetMapping(value = "/getInquiry")
    public AjaxResult getInquiry(String tenantId)
    {
        return success(baseInquiryService.getInquiry(tenantId));
    }

    /**
     * 新增在线询盘设置
     */
    @PreAuthorize("@ss.hasPermi('base:inquiry:add')")
    @Log(title = "在线询盘设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BaseInquiry baseInquiry)
    {
        return toAjax(baseInquiryService.saveOrUpdate(baseInquiry));
    }

    /**
     * 修改在线询盘设置
     */
    @PreAuthorize("@ss.hasPermi('base:inquiry:edit')")
    @Log(title = "在线询盘设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BaseInquiry baseInquiry)
    {
        return toAjax(baseInquiryService.saveOrUpdate(baseInquiry));
    }

}
