package com.linkwechat.wecom.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeCustomerPortrait;
import com.linkwechat.wecom.domain.WeCustomerSocialConn;
import com.linkwechat.wecom.domain.WeUser;
import org.apache.ibatis.annotations.Param;

/**
 * 企业微信客户Mapper接口
 * 
 * @author ruoyi
 * @date 2020-09-13
 */
public interface WeCustomerMapper  extends BaseMapper<WeCustomer>
{

    /**
     * 批量新增
     * @param customerList
     */
    void insertBatch(@Param("weCustomerList") List<WeCustomer> customerList);
    
    /**
     * 查询id企业微信客户
     * 
     * @param id
     * @return 企业微信客户
     */
    public WeCustomer selectWeCustomerById(Long id);

    /**
     * 查询eid企业微信客户
     *
     * @param externalUserid
     * @return 企业微信客户
     */
    public WeCustomer selectWeCustomerByEid(String externalUserid);

    /**
     * 查询企业微信客户列表
     * 
     * @param weCustomer 企业微信客户
     * @return 企业微信客户集合
     */
    public List<WeCustomer> selectWeCustomerList(WeCustomer weCustomer);
    
    /**
     * 根据员工ID获取客户
     * @param userId
     * @return
     */
    public List<WeCustomer> getCustomersByUserId(@Param("userId") String userId);

    /**
     * 根据外部联系人ID和企业员工ID获取当前客户信息
     * @param externalUserid
     * @param userid
     * @return
     */
    WeCustomerPortrait findCustomerByOperUseridAndCustomerId(@Param("externalUserid") String externalUserid,@Param("userid") String userid);


    /**
     * 统计客户社交关系
     * @param externalUserid 客户id
     * @param userid 员工id
     * @return
     */
    WeCustomerSocialConn countSocialConn(@Param("externalUserid")String externalUserid,@Param("userid")String userid);

    
}
