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.ChatRoleMapper;
import com.fs.chat.domain.ChatRole;
import com.fs.chat.service.IChatRoleService;

/**
 * 聊天角色Service业务层处理
 *
 * @author fs
 * @date 2024-04-19
 */
@Service
public class ChatRoleServiceImpl implements IChatRoleService
{
    @Autowired
    private ChatRoleMapper chatRoleMapper;

    /**
     * 查询聊天角色
     *
     * @param roleId 聊天角色主键
     * @return 聊天角色
     */
    @Override
    public ChatRole selectChatRoleByRoleId(Long roleId)
    {
        return chatRoleMapper.selectChatRoleByRoleId(roleId);
    }

    /**
     * 查询聊天角色列表
     *
     * @param chatRole 聊天角色
     * @return 聊天角色
     */
    @Override
    public List<ChatRole> selectChatRoleList(ChatRole chatRole)
    {
        return chatRoleMapper.selectChatRoleList(chatRole);
    }

    /**
     * 新增聊天角色
     *
     * @param chatRole 聊天角色
     * @return 结果
     */
    @Override
    public int insertChatRole(ChatRole chatRole)
    {
        chatRole.setCreateTime(DateUtils.getNowDate());
        return chatRoleMapper.insertChatRole(chatRole);
    }

    /**
     * 修改聊天角色
     *
     * @param chatRole 聊天角色
     * @return 结果
     */
    @Override
    public int updateChatRole(ChatRole chatRole)
    {
        chatRole.setUpdateTime(DateUtils.getNowDate());
        return chatRoleMapper.updateChatRole(chatRole);
    }

    /**
     * 批量删除聊天角色
     *
     * @param roleIds 需要删除的聊天角色主键
     * @return 结果
     */
    @Override
    public int deleteChatRoleByRoleIds(Long[] roleIds)
    {
        return chatRoleMapper.deleteChatRoleByRoleIds(roleIds);
    }

    /**
     * 删除聊天角色信息
     *
     * @param roleId 聊天角色主键
     * @return 结果
     */
    @Override
    public int deleteChatRoleByRoleId(Long roleId)
    {
        return chatRoleMapper.deleteChatRoleByRoleId(roleId);
    }

    @Override
    public ChatRole selectChatRoleByKfId(String open_kfid) {
        return chatRoleMapper.selectChatRoleByKfId(open_kfid);
    }
}
