package com.fs.crm.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.crm.param.CrmCustomerAssistDeLParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.crm.mapper.CrmCustomerAssistMapper;
import com.fs.crm.domain.CrmCustomerAssist;
import com.fs.crm.service.ICrmCustomerAssistService;

/**
 * 客户员工协作Service业务层处理
 *
 * @author fs
 * @date 2025-05-27
 */
@Service
public class CrmCustomerAssistServiceImpl implements ICrmCustomerAssistService
{
    @Autowired
    private CrmCustomerAssistMapper crmCustomerAssistMapper;

    /**
     * 查询客户员工协作
     *
     * @param id 客户员工协作ID
     * @return 客户员工协作
     */
    @Override
    public CrmCustomerAssist selectCrmCustomerAssistById(Long id)
    {
        return crmCustomerAssistMapper.selectCrmCustomerAssistById(id);
    }

    /**
     * 查询客户员工协作列表
     *
     * @param crmCustomerAssist 客户员工协作
     * @return 客户员工协作
     */
    @Override
    public List<CrmCustomerAssist> selectCrmCustomerAssistList(CrmCustomerAssist crmCustomerAssist)
    {
        return crmCustomerAssistMapper.selectCrmCustomerAssistList(crmCustomerAssist);
    }

    /**
     * 新增客户员工协作
     *
     * @param crmCustomerAssist 客户员工协作
     * @return 结果
     */
    @Override
    public int insertCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist)
    {
        crmCustomerAssist.setCreateTime(DateUtils.getNowDate());
        return crmCustomerAssistMapper.insertCrmCustomerAssist(crmCustomerAssist);
    }

    /**
     * 修改客户员工协作
     *
     * @param crmCustomerAssist 客户员工协作
     * @return 结果
     */
    @Override
    public int updateCrmCustomerAssist(CrmCustomerAssist crmCustomerAssist)
    {
        return crmCustomerAssistMapper.updateCrmCustomerAssist(crmCustomerAssist);
    }

    /**
     * 批量删除客户员工协作
     *
     * @param ids 需要删除的客户员工协作ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerAssistByIds(Long[] ids)
    {
        return crmCustomerAssistMapper.deleteCrmCustomerAssistByIds(ids);
    }

    /**
     * 删除客户员工协作信息
     *
     * @param id 客户员工协作ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerAssistById(Long id)
    {
        return crmCustomerAssistMapper.deleteCrmCustomerAssistById(id);
    }

    @Override
    public int removeByCustomer(CrmCustomerAssistDeLParam param) {
        if (param.getCustomerIds() == null || param.getCustomerIds().isEmpty()) {
            return 0;
        }
        return crmCustomerAssistMapper.removeByCustomer(param);
    }
}
