package com.xunwang.ucenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xunwang.ucenter.entity.InviteInfo;
import com.xunwang.ucenter.mapper.InviteInfoMapper;
import com.xunwang.ucenter.service.InviteInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Guan
 * @since 2023-01-03
 */
@Service
public class InviteInfoServiceImpl extends ServiceImpl<InviteInfoMapper, InviteInfo> implements InviteInfoService {

    //点击进入我收到的邀请详情，改变我方状态从未读变为待定
    @Override
    public void modifyStatusToHold(String require_id) {
        QueryWrapper<InviteInfo> wrapper = new QueryWrapper<>();
        wrapper.eq("require_id",require_id);
        wrapper.eq("operate_status","未读");
        InviteInfo inviteInfo = baseMapper.selectOne(wrapper);
        if (inviteInfo != null){
            InviteInfo info = new InviteInfo();
            info.setOperateStatus("待定");
            baseMapper.update(info,wrapper);
        }
    }
}
