package com.fs.chat.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.chat.mapper.ChatUserMapper;
import com.fs.chat.domain.ChatUser;
import com.fs.chat.service.IChatUserService;

/**
 * 客户Service业务层处理
 *
 * @author fs
 * @date 2024-05-11
 */
@Service
public class ChatUserServiceImpl implements IChatUserService
{
    @Autowired
    private ChatUserMapper chatUserMapper;

    /**
     * 查询客户
     *
     * @param userId 客户主键
     * @return 客户
     */
    @Override
    public ChatUser selectChatUserByUserId(Long userId)
    {
        return chatUserMapper.selectChatUserByUserId(userId);
    }

    /**
     * 查询客户列表
     *
     * @param chatUser 客户
     * @return 客户
     */
    @Override
    public List<ChatUser> selectChatUserList(ChatUser chatUser)
    {
        return chatUserMapper.selectChatUserList(chatUser);
    }

    /**
     * 新增客户
     *
     * @param chatUser 客户
     * @return 结果
     */
    @Override
    public int insertChatUser(ChatUser chatUser)
    {
        chatUser.setCreateTime(DateUtils.getNowDate());
        return chatUserMapper.insertChatUser(chatUser);
    }

    /**
     * 修改客户
     *
     * @param chatUser 客户
     * @return 结果
     */
    @Override
    public int updateChatUser(ChatUser chatUser)
    {
        return chatUserMapper.updateChatUser(chatUser);
    }

    /**
     * 批量删除客户
     *
     * @param userIds 需要删除的客户主键
     * @return 结果
     */
    @Override
    public int deleteChatUserByUserIds(Long[] userIds)
    {
        return chatUserMapper.deleteChatUserByUserIds(userIds);
    }

    /**
     * 删除客户信息
     *
     * @param userId 客户主键
     * @return 结果
     */
    @Override
    public int deleteChatUserByUserId(Long userId)
    {
        return chatUserMapper.deleteChatUserByUserId(userId);
    }

    @Override
    public ChatUser selectChatUserByExternalUserId(String external_userid) {
        return chatUserMapper.selectChatUserByExternalUserId(external_userid);
    }
}
