EntmicroCustomerFollowMapper.java 3.79 KB
package cn.com.glsx.entmicro.mapper;

import cn.com.glsx.entmicro.entity.Customer;
import cn.com.glsx.entmicro.entity.EntmicroCustomerFollow;
import cn.com.glsx.entmicro.model.customer.CustomerRelationDataPushModel;
import cn.com.glsx.entmicro.model.customer.SyncCustomerTypeTagModel;
import cn.com.glsx.entmicro.model.response.CustomerFollowStaffResponse;
import cn.com.glsx.entmicro.model.response.CustomerInfo;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Mapper
public interface EntmicroCustomerFollowMapper extends CommonBaseMapper<EntmicroCustomerFollow> {

    void deleteRelation(@Param("id") Integer id);

    void deleteCustomer(Integer id);

    void updatelist(@Param("list") List<EntmicroCustomerFollow> buildFollowParam);

    List<EntmicroCustomerFollow> findFollowByExternalUserId(@Param("externalUserId") String externalUserId,
                                                            @Param("merchantId") Integer merchantId);

    List<EntmicroCustomerFollow> findAllFollowByExternalUserId(@Param("externalUserId") String externalUserId);

    /**
     * 校验重复数据
     *
     * @param customerId
     * @param staffId
     * @return
     */
    List<EntmicroCustomerFollow> findRelationByStaffId(@Param("customerId") Integer customerId, @Param("staffId") Set<Integer> staffId);

    /**
     * id获取关联数据
     *
     * @param id
     * @return
     */
    CustomerFollowStaffResponse findRelationById(@Param("id") Integer id);

    /**
     * id获取关联数据
     *
     * @param id
     * @return
     */
    List<CustomerFollowStaffResponse> findRelationByUserId(@Param("id") String id);

    /**
     * 修改手机号
     *
     * @param
     */
    void updatePhone(EntmicroCustomerFollow entmicroCustomerFollow);

    /**
     * 修改合并表手机号
     */
    CustomerInfo findByRelationId(@Param("id") Integer id);

    /**
     * 员工id查客户关系
     *
     * @param staffId
     * @return
     */
    List<EntmicroCustomerFollow> findByStaffId(@Param("staffId") Integer staffId);

    /**
     * 批量补充备注手机号
     *
     * @param customer
     */
    int updateBatchInfo(@Param("customer") List<Customer> customer);

    /**
     * 批量查客户跟进关系
     *
     * @param userIdList
     * @return
     */
    List<EntmicroCustomerFollow> findBatchRelationInfo(@Param("userIdList") List<String> userIdList);

    /**
     * 根据渠道统计客户
     *
     * @param stateList
     * @return
     */
    List<EntmicroCustomerFollow> mapByState(@Param("stateList") List<String> stateList, @Param("date") String date,
                                            @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    /**
     * 根据userId或手机号查询客户关联关系
     *
     * @param param 参数
     * @return
     */
    List<CustomerRelationDataPushModel> findCustomerRelationByUserIdOrPhone(@Param("param") SyncCustomerTypeTagModel param,
                                                                            @Param("merchantIds") List<Integer> merchantIds);

    /**
     * 查找客户员工跟进关系
     *
     * @param merchantIdList
     * @param customerPhone
     * @param staffUserIdList
     * @return
     */
    List<EntmicroCustomerFollow> findCustomerStaffFollow(@Param("merchantIdList") List<Integer> merchantIdList, @Param("customerPhone") String customerPhone,
                                                         @Param("staffUserIdList") List<String> staffUserIdList);

    List<Map<String, Object>> selectCustomerFollowRemark(@Param("updateTime") Date updateTime, @Param("merchantIdList") List<Integer> merchantIdList);
}