1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package com.ym.dao;
- import com.ym.pojo.RoomMember;
- import org.springframework.data.jpa.repository.JpaRepository;
- import org.springframework.data.jpa.repository.Lock;
- import org.springframework.data.jpa.repository.Modifying;
- import org.springframework.data.jpa.repository.Query;
- import org.springframework.stereotype.Repository;
- import org.springframework.transaction.annotation.Transactional;
- import javax.persistence.LockModeType;
- import java.util.List;
- /**
- * Created by weiqinxiao on 2019/2/25.
- */
- @Repository
- public interface RoomMemberDao extends JpaRepository<RoomMember, Long> {
- public List<RoomMember> findByRid(String rid);
- @Lock(value = LockModeType.PESSIMISTIC_WRITE)
- public List<RoomMember> findByRidAndUid(String rid, String uid);
- public List<RoomMember> findByRidAndRole(String rid, int role);
- public List<RoomMember> findByUid(String uid);
- public int countByRidAndRole(String rid, int role);
- @Modifying
- @Transactional
- public int deleteByRid(String roomId);
- @Query(value = "select count(*) from rongyun_room_member where rid=?1", nativeQuery = true)
- public int countByRid(String roomId);
- @Query(value = "select count(*) from rongyun_room_member where rid=?1 and role!=?2", nativeQuery = true)
- public int countByRidAndExcludeRole(String roomId, int excludeRole);
- @Transactional
- @Modifying
- @Query(value = "delete from rongyun_room_member where rid=?1 and uid=?2", nativeQuery = true)
- public int deleteUserByRidAndUid(String rid, String uid);
- @Transactional
- @Modifying
- @Query(value = "update rongyun_room_member set role=?3 where rid=?1 and uid=?2", nativeQuery = true)
- public int updateRoleByRidAndUid(String rid, String uid, int role);
- @Transactional
- @Modifying
- @Query(value = "update rongyun_room_member set role=?3 where rid=?1 and role=?2", nativeQuery = true)
- public int updateRoleByRidAndRole(String rid, int role);
- @Transactional
- @Modifying
- @Query(value = "update rongyun_room_member set camera=?3 where rid=?1 and uid=?2", nativeQuery = true)
- public int updateCameraByRidAndUid(String rid, String uid, boolean camera);
- @Transactional
- @Modifying
- @Query(value = "update rongyun_room_member set mic=?3 where rid=?1 and uid=?2", nativeQuery = true)
- public int updateMicByRidAndUid(String rid, String uid, boolean mic);
- @Transactional
- @Modifying
- @Query(value = "update rongyun_room_member set music_mode=?3 where rid=?1 and uid=?2", nativeQuery = true)
- public int updateMusicByRidAndUid(String rid, String uid, boolean musicMode);
- public boolean existsByRidAndUid(String rid, String uid);
- public boolean existsByRidAndRole(String rid, int role);
- }
|