package com.fs.crm.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.crm.mapper.CrmCustomerUserMapper;
import com.fs.crm.domain.CrmCustomerUser;
import com.fs.crm.service.ICrmCustomerUserService;

/**
 * 客户员工认领Service业务层处理
 * 
 * @author fs
 * @date 2022-12-21
 */
@Service
public class CrmCustomerUserServiceImpl implements ICrmCustomerUserService 
{
    @Autowired
    private CrmCustomerUserMapper crmCustomerUserMapper;

    /**
     * 查询客户员工认领
     * 
     * @param customerUserId 客户员工认领ID
     * @return 客户员工认领
     */
    @Override
    public CrmCustomerUser selectCrmCustomerUserById(Long customerUserId)
    {
        return crmCustomerUserMapper.selectCrmCustomerUserById(customerUserId);
    }

    /**
     * 查询客户员工认领列表
     * 
     * @param crmCustomerUser 客户员工认领
     * @return 客户员工认领
     */
    @Override
    public List<CrmCustomerUser> selectCrmCustomerUserList(CrmCustomerUser crmCustomerUser)
    {
        return crmCustomerUserMapper.selectCrmCustomerUserList(crmCustomerUser);
    }

    /**
     * 新增客户员工认领
     * 
     * @param crmCustomerUser 客户员工认领
     * @return 结果
     */
    @Override
    public int insertCrmCustomerUser(CrmCustomerUser crmCustomerUser)
    {
        crmCustomerUser.setCreateTime(DateUtils.getNowDate());
        return crmCustomerUserMapper.insertCrmCustomerUser(crmCustomerUser);
    }

    /**
     * 修改客户员工认领
     * 
     * @param crmCustomerUser 客户员工认领
     * @return 结果
     */
    @Override
    public int updateCrmCustomerUser(CrmCustomerUser crmCustomerUser)
    {
        return crmCustomerUserMapper.updateCrmCustomerUser(crmCustomerUser);
    }

    /**
     * 批量删除客户员工认领
     * 
     * @param customerUserIds 需要删除的客户员工认领ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerUserByIds(Long[] customerUserIds)
    {
        return crmCustomerUserMapper.deleteCrmCustomerUserByIds(customerUserIds);
    }

    /**
     * 删除客户员工认领信息
     * 
     * @param customerUserId 客户员工认领ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerUserById(Long customerUserId)
    {
        return crmCustomerUserMapper.deleteCrmCustomerUserById(customerUserId);
    }

    @Override
    public Integer selectCrmMyCustomerUserCount(Long companyId, long userId) {
        return crmCustomerUserMapper.selectCrmMyCustomerUserCount(companyId,userId);
    }


}
