package com.ruoyi.xq.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.xq.domain.User;
import com.ruoyi.xq.domain.UserChatFilter;
import com.ruoyi.xq.mapper.UserChatFilterMapper;
import com.ruoyi.xq.service.UserChatFilterService;
import org.springframework.stereotype.Service;

/**
 * 聊天记录过滤Service业务层处理
 *
 * @author 77
 * @date 2024-03-26
 */
@Service
public class UserChatFilterServiceImpl extends ServiceImpl<UserChatFilterMapper,UserChatFilter> implements UserChatFilterService {
    @Override
    public void saveFilter(User fromUser, User toUser, String sourceContent, String filterContent) {
        UserChatFilter chatFilter = new UserChatFilter();
        chatFilter.setFromUid(fromUser.getId());
        chatFilter.setFromUsercode(fromUser.getUsercode());
        chatFilter.setToUid(toUser.getId());
        chatFilter.setToUsercode(toUser.getUsercode());
        chatFilter.setContent(sourceContent);
        chatFilter.setFilterContent(filterContent);
        this.save(chatFilter);
    }
}
