package com.fs.company.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.company.domain.CompanyVoiceApi;
import com.fs.company.domain.CompanyVoiceApiTiantian;
import com.fs.company.mapper.CompanyVoiceApiMapper;
import com.fs.company.mapper.CompanyVoiceApiTiantianMapper;
import com.fs.company.service.ICompanyVoiceApiService;
import com.fs.company.service.ICompanyVoiceApiTiantianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

/**
 * 呼叫接口Service业务层处理
 * 
 * @author fs
 * @date 2021-10-04
 */
@Service
public class CompanyVoiceApiTiantianServiceImpl extends ServiceImpl<CompanyVoiceApiTiantianMapper, CompanyVoiceApiTiantian> implements ICompanyVoiceApiTiantianService {
    @Autowired
    private CompanyVoiceApiTiantianMapper companyVoiceApiMapper;

    /**
     * 查询呼叫接口
     * 
     * @param apiId 呼叫接口ID
     * @return 呼叫接口
     */
    @Override
    public CompanyVoiceApiTiantian selectCompanyVoiceApiById(Long apiId)
    {
        return companyVoiceApiMapper.selectById(apiId);
    }

    /**
     * 查询呼叫接口列表
     * 
     * @param companyVoiceApi 呼叫接口
     * @return 呼叫接口
     */
    @Override
    public List<CompanyVoiceApiTiantian> selectCompanyVoiceApiList(CompanyVoiceApiTiantian companyVoiceApi)
    {
        return list();
    }

    /**
     * 新增呼叫接口
     * 
     * @param companyVoiceApi 呼叫接口
     * @return 结果
     */
    @Override
    public int insertCompanyVoiceApi(CompanyVoiceApiTiantian companyVoiceApi)
    {
        return companyVoiceApiMapper.insert(companyVoiceApi);
    }

    /**
     * 修改呼叫接口
     * 
     * @param companyVoiceApi 呼叫接口
     * @return 结果
     */
    @Override
    public int updateCompanyVoiceApi(CompanyVoiceApiTiantian companyVoiceApi)
    {
        return companyVoiceApiMapper.updateById(companyVoiceApi);
    }

    /**
     * 批量删除呼叫接口
     * 
     * @param apiIds 需要删除的呼叫接口ID
     * @return 结果
     */
    @Override
    public int deleteCompanyVoiceApiByIds(Long[] apiIds)
    {
        return companyVoiceApiMapper.deleteBatchIds(Arrays.asList(apiIds));
    }

    /**
     * 删除呼叫接口信息
     * 
     * @param apiId 呼叫接口ID
     * @return 结果
     */
    @Override
    public int deleteCompanyVoiceApiById(Long apiId)
    {
        return companyVoiceApiMapper.deleteById(apiId);
    }

    @Override
    public Integer selectCompanyVoiceApiCount() {
        return companyVoiceApiMapper.selectCount(new QueryWrapper<>());
    }
}
