package com.fs.company.controller;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.company.domain.CompanyVoiceRoboticWx;
import com.fs.company.service.ICompanyVoiceRoboticWxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * AI外呼任务加微方式Controller
 * 
 * @author fs
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/company/VoiceRoboticWx")
public class CompanyVoiceRoboticWxController extends BaseController
{
    @Autowired
    private ICompanyVoiceRoboticWxService companyVoiceRoboticWxService;

    /**
     * 查询AI外呼任务加微方式列表
     */
    @PreAuthorize("@ss.hasPermi('company:VoiceRoboticWx:list')")
    @GetMapping("/list")
    public TableDataInfo list(CompanyVoiceRoboticWx companyVoiceRoboticWx)
    {
        startPage();
        List<CompanyVoiceRoboticWx> list = companyVoiceRoboticWxService.selectCompanyVoiceRoboticWxList(companyVoiceRoboticWx);
        return getDataTable(list);
    }

    /**
     * 导出AI外呼任务加微方式列表
     */
    @PreAuthorize("@ss.hasPermi('company:VoiceRoboticWx:export')")
    @Log(title = "AI外呼任务加微方式", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CompanyVoiceRoboticWx companyVoiceRoboticWx)
    {
        List<CompanyVoiceRoboticWx> list = companyVoiceRoboticWxService.selectCompanyVoiceRoboticWxList(companyVoiceRoboticWx);
        ExcelUtil<CompanyVoiceRoboticWx> util = new ExcelUtil<CompanyVoiceRoboticWx>(CompanyVoiceRoboticWx.class);
        return util.exportExcel(list, "VoiceRoboticWx");
    }

    /**
     * 获取AI外呼任务加微方式详细信息
     */
    @PreAuthorize("@ss.hasPermi('company:VoiceRoboticWx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(companyVoiceRoboticWxService.selectCompanyVoiceRoboticWxById(id));
    }

    /**
     * 新增AI外呼任务加微方式
     */
    @PreAuthorize("@ss.hasPermi('company:VoiceRoboticWx:add')")
    @Log(title = "AI外呼任务加微方式", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CompanyVoiceRoboticWx companyVoiceRoboticWx)
    {
        return toAjax(companyVoiceRoboticWxService.insertCompanyVoiceRoboticWx(companyVoiceRoboticWx));
    }

    /**
     * 修改AI外呼任务加微方式
     */
    @PreAuthorize("@ss.hasPermi('company:VoiceRoboticWx:edit')")
    @Log(title = "AI外呼任务加微方式", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CompanyVoiceRoboticWx companyVoiceRoboticWx)
    {
        return toAjax(companyVoiceRoboticWxService.updateCompanyVoiceRoboticWx(companyVoiceRoboticWx));
    }

    /**
     * 删除AI外呼任务加微方式
     */
    @PreAuthorize("@ss.hasPermi('company:VoiceRoboticWx:remove')")
    @Log(title = "AI外呼任务加微方式", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(companyVoiceRoboticWxService.deleteCompanyVoiceRoboticWxByIds(ids));
    }
}
