2026-06-30 24681c81c09022f584a57006f2534b5f74723414
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package cn.iocoder.yudao.module.im.dal.mysql.rtc;
 
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.im.dal.dataobject.rtc.ImRtcParticipantDO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
 
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
 
/**
 * IM 通话参与者 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ImRtcParticipantMapper extends BaseMapperX<ImRtcParticipantDO> {
 
    default ImRtcParticipantDO selectByRoomAndUserId(String room, Long userId) {
        return selectOne(new LambdaQueryWrapperX<ImRtcParticipantDO>()
                .eq(ImRtcParticipantDO::getRoom, room)
                .eq(ImRtcParticipantDO::getUserId, userId));
    }
 
    default List<ImRtcParticipantDO> selectListByRoom(String room) {
        return selectList(ImRtcParticipantDO::getRoom, room);
    }
 
    default List<ImRtcParticipantDO> selectListByCallId(Long callId) {
        return selectList(ImRtcParticipantDO::getCallId, callId);
    }
 
    default List<ImRtcParticipantDO> selectListByStatusAndInviteTimeBefore(Integer status, LocalDateTime threshold) {
        return selectList(new LambdaQueryWrapperX<ImRtcParticipantDO>()
                .eq(ImRtcParticipantDO::getStatus, status)
                .lt(ImRtcParticipantDO::getInviteTime, threshold));
    }
 
    default List<ImRtcParticipantDO> selectListByRoomAndStatusAndInviteTimeBefore(String room, Integer status, LocalDateTime threshold) {
        return selectList(new LambdaQueryWrapperX<ImRtcParticipantDO>()
                .eq(ImRtcParticipantDO::getRoom, room)
                .eq(ImRtcParticipantDO::getStatus, status)
                .lt(ImRtcParticipantDO::getInviteTime, threshold));
    }
 
    default ImRtcParticipantDO selectLastOneByUserIdAndStatus(Long userId, Collection<Integer> statuses) {
        return selectLastOne(new LambdaQueryWrapperX<ImRtcParticipantDO>()
                .eq(ImRtcParticipantDO::getUserId, userId)
                .in(ImRtcParticipantDO::getStatus, statuses));
    }
 
    default ImRtcParticipantDO selectLastOneByUserIdAndStatusInAndRoomNot(Long userId, Collection<Integer> statuses, String room) {
        return selectLastOne(new LambdaQueryWrapperX<ImRtcParticipantDO>()
                .eq(ImRtcParticipantDO::getUserId, userId)
                .in(ImRtcParticipantDO::getStatus, statuses)
                .ne(ImRtcParticipantDO::getRoom, room));
    }
 
    @SuppressWarnings("UnusedReturnValue")
    default int updateByIdAndStatus(Long id, Integer oldStatus, ImRtcParticipantDO updateObj) {
        return update(updateObj, Wrappers.<ImRtcParticipantDO>lambdaUpdate()
                .eq(ImRtcParticipantDO::getId, id)
                .eq(ImRtcParticipantDO::getStatus, oldStatus));
    }
 
    @SuppressWarnings("UnusedReturnValue")
    default int updateByRoomAndStatus(String room, Integer oldStatus, ImRtcParticipantDO updateObj) {
        return update(updateObj, Wrappers.<ImRtcParticipantDO>lambdaUpdate()
                .eq(ImRtcParticipantDO::getRoom, room)
                .eq(ImRtcParticipantDO::getStatus, oldStatus));
    }
 
}