package com.fs.crm.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.crm.param.CrmCustomerContactsListQueryParam;
import com.fs.crm.vo.CrmCustomerContactsListQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.crm.mapper.CrmCustomerContactsMapper;
import com.fs.crm.domain.CrmCustomerContacts;
import com.fs.crm.service.ICrmCustomerContactsService;

/**
 * 客户联系人Service业务层处理
 * 
 * @author fs
 * @date 2023-03-14
 */
@Service
public class CrmCustomerContactsServiceImpl implements ICrmCustomerContactsService 
{
    @Autowired
    private CrmCustomerContactsMapper crmCustomerContactsMapper;

    /**
     * 查询客户联系人
     * 
     * @param contactsId 客户联系人ID
     * @return 客户联系人
     */
    @Override
    public CrmCustomerContacts selectCrmCustomerContactsById(Long contactsId)
    {
        return crmCustomerContactsMapper.selectCrmCustomerContactsById(contactsId);
    }

    /**
     * 查询客户联系人列表
     * 
     * @param crmCustomerContacts 客户联系人
     * @return 客户联系人
     */
    @Override
    public List<CrmCustomerContacts> selectCrmCustomerContactsList(CrmCustomerContacts crmCustomerContacts)
    {
        return crmCustomerContactsMapper.selectCrmCustomerContactsList(crmCustomerContacts);
    }

    /**
     * 新增客户联系人
     * 
     * @param crmCustomerContacts 客户联系人
     * @return 结果
     */
    @Override
    public int insertCrmCustomerContacts(CrmCustomerContacts crmCustomerContacts)
    {
        if(crmCustomerContacts.getCreateTime()==null){
            crmCustomerContacts.setCreateTime(DateUtils.getNowDate());
        }
        return crmCustomerContactsMapper.insertCrmCustomerContacts(crmCustomerContacts);
    }

    /**
     * 修改客户联系人
     * 
     * @param crmCustomerContacts 客户联系人
     * @return 结果
     */
    @Override
    public int updateCrmCustomerContacts(CrmCustomerContacts crmCustomerContacts)
    {
        crmCustomerContacts.setUpdateTime(DateUtils.getNowDate());
        return crmCustomerContactsMapper.updateCrmCustomerContacts(crmCustomerContacts);
    }

    /**
     * 批量删除客户联系人
     * 
     * @param contactsIds 需要删除的客户联系人ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerContactsByIds(Long[] contactsIds)
    {
        return crmCustomerContactsMapper.deleteCrmCustomerContactsByIds(contactsIds);
    }

    /**
     * 删除客户联系人信息
     * 
     * @param contactsId 客户联系人ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerContactsById(Long contactsId)
    {
        return crmCustomerContactsMapper.deleteCrmCustomerContactsById(contactsId);
    }

    @Override
    public List<CrmCustomerContactsListQueryVO> selectCrmCustomerContactsListQuery(CrmCustomerContactsListQueryParam param) {
        return crmCustomerContactsMapper.selectCrmCustomerContactsListQuery(param);
    }
}
