package com.fs.company.controller.company;

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.CompanyVoiceRoboticCallees;
import com.fs.company.service.ICompanyVoiceRoboticCalleesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 任务外呼电话Controller
 * 
 * @author fs
 * @date 2024-12-04
 */
@RestController
@RequestMapping("/company/companyVoiceRoboticCallees")
public class CompanyVoiceRoboticCalleesController extends BaseController
{
    @Autowired
    private ICompanyVoiceRoboticCalleesService companyVoiceRoboticCalleesService;

    /**
     * 查询任务外呼电话列表
     */
    @PreAuthorize("@ss.hasPermi('system:companyVoiceRoboticCallees:list')")
    @GetMapping("/list")
    public TableDataInfo list(CompanyVoiceRoboticCallees companyVoiceRoboticCallees)
    {
        startPage();
        List<CompanyVoiceRoboticCallees> list = companyVoiceRoboticCalleesService.selectCompanyVoiceRoboticCalleesList(companyVoiceRoboticCallees);
        return getDataTable(list);
    }

    /**
     * 导出任务外呼电话列表
     */
    @PreAuthorize("@ss.hasPermi('system:companyVoiceRoboticCallees:export')")
    @Log(title = "任务外呼电话", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CompanyVoiceRoboticCallees companyVoiceRoboticCallees)
    {
        List<CompanyVoiceRoboticCallees> list = companyVoiceRoboticCalleesService.selectCompanyVoiceRoboticCalleesList(companyVoiceRoboticCallees);
        ExcelUtil<CompanyVoiceRoboticCallees> util = new ExcelUtil<CompanyVoiceRoboticCallees>(CompanyVoiceRoboticCallees.class);
        return util.exportExcel(list, "callees");
    }

    /**
     * 获取任务外呼电话详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:companyVoiceRoboticCallees:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(companyVoiceRoboticCalleesService.selectCompanyVoiceRoboticCalleesById(id));
    }

    /**
     * 新增任务外呼电话
     */
    @PreAuthorize("@ss.hasPermi('system:companyVoiceRoboticCallees:add')")
    @Log(title = "任务外呼电话", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CompanyVoiceRoboticCallees companyVoiceRoboticCallees)
    {
        return toAjax(companyVoiceRoboticCalleesService.insertCompanyVoiceRoboticCallees(companyVoiceRoboticCallees));
    }

    /**
     * 修改任务外呼电话
     */
    @PreAuthorize("@ss.hasPermi('system:companyVoiceRoboticCallees:edit')")
    @Log(title = "任务外呼电话", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CompanyVoiceRoboticCallees companyVoiceRoboticCallees)
    {
        return toAjax(companyVoiceRoboticCalleesService.updateCompanyVoiceRoboticCallees(companyVoiceRoboticCallees));
    }

    /**
     * 删除任务外呼电话
     */
    @PreAuthorize("@ss.hasPermi('system:companyVoiceRoboticCallees:remove')")
    @Log(title = "任务外呼电话", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(companyVoiceRoboticCalleesService.deleteCompanyVoiceRoboticCalleesByIds(ids));
    }
}
