package com.fs.aiob.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.aiob.domain.AiobBaiduCallApi;
import com.fs.aiob.service.IAiobBaiduCallApiService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 百度外呼接口配置Controller
 * 
 * @author fs
 * @date 2025-03-20
 */
@RestController
@RequestMapping("/aiob/AiobBaiduCallApi")
public class AiobBaiduCallApiController extends BaseController
{
    @Autowired
    private IAiobBaiduCallApiService aiobBaiduCallApiService;

    /**
     * 查询百度外呼接口配置列表
     */
    @PreAuthorize("@ss.hasPermi('aiob:AiobBaiduCallApi:list')")
    @GetMapping("/list")
    public TableDataInfo list(AiobBaiduCallApi aiobBaiduCallApi)
    {
        startPage();
        List<AiobBaiduCallApi> list = aiobBaiduCallApiService.selectAiobBaiduCallApiList(aiobBaiduCallApi);
        return getDataTable(list);
    }

    /**
     * 导出百度外呼接口配置列表
     */
    @PreAuthorize("@ss.hasPermi('aiob:AiobBaiduCallApi:export')")
    @Log(title = "百度外呼接口配置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AiobBaiduCallApi aiobBaiduCallApi)
    {
        List<AiobBaiduCallApi> list = aiobBaiduCallApiService.selectAiobBaiduCallApiList(aiobBaiduCallApi);
        ExcelUtil<AiobBaiduCallApi> util = new ExcelUtil<AiobBaiduCallApi>(AiobBaiduCallApi.class);
        return util.exportExcel(list, "百度外呼接口配置数据");
    }

    /**
     * 获取百度外呼接口配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('aiob:AiobBaiduCallApi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(aiobBaiduCallApiService.selectAiobBaiduCallApiById(id));
    }

    /**
     * 新增百度外呼接口配置
     */
    @PreAuthorize("@ss.hasPermi('aiob:AiobBaiduCallApi:add')")
    @Log(title = "百度外呼接口配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AiobBaiduCallApi aiobBaiduCallApi)
    {
        return toAjax(aiobBaiduCallApiService.insertAiobBaiduCallApi(aiobBaiduCallApi));
    }

    /**
     * 修改百度外呼接口配置
     */
    @PreAuthorize("@ss.hasPermi('aiob:AiobBaiduCallApi:edit')")
    @Log(title = "百度外呼接口配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AiobBaiduCallApi aiobBaiduCallApi)
    {
        return toAjax(aiobBaiduCallApiService.updateAiobBaiduCallApi(aiobBaiduCallApi));
    }

    /**
     * 删除百度外呼接口配置
     */
    @PreAuthorize("@ss.hasPermi('aiob:AiobBaiduCallApi:remove')")
    @Log(title = "百度外呼接口配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(aiobBaiduCallApiService.deleteAiobBaiduCallApiByIds(ids));
    }
}
