@@ -18,6 +18,7 @@ public interface ImUserFriendDao extends BaseMapper<ImUserFriend> {
ImUserFriend findByUserIdAndFriendId(@Param("userId") Long userId, @Param("friendId") Long friendId);
- void delFriendByTenantId(@Param("tenantId") Long tenantId,@Param("userId") Long userId);
+ void delFriendByTenantId(@Param("tenantId") Long tenantId,@Param("userId") Long userId ,
+ @Param("clientType") String clientType);
}
@@ -65,6 +65,6 @@ public interface ImUserFriendService extends IService<ImUserFriend> {
*/
List<ImUserWrapper.ImUserFriend> findUserAllImFriendInfo(ClientEnum clientType, Long userId, Map<String, Object> paramMap);
- void delFriendByTenantId(Long tenantId, Long userId);
+ void delFriendByTenantId(Long tenantId, Long userId, String clientType);
@@ -403,10 +403,11 @@ public class ImUserFriendServiceImpl extends ServiceImpl<ImUserFriendDao, ImUser
*
* @param tenantId 机构ID
* @param userId 用户ID
+ * @param clientType 用户类型,处理同账号多角色问题
@Override
- public void delFriendByTenantId(Long tenantId, Long userId) {
- this.baseMapper.delFriendByTenantId(tenantId, userId);
+ public void delFriendByTenantId(Long tenantId, Long userId, String clientType) {
+ this.baseMapper.delFriendByTenantId(tenantId, userId, clientType);
@@ -521,7 +521,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
// 删除机构好友关系
- imUserFriendService.delFriendByTenantId(tenantId, student.getUserId());
+ imUserFriendService.delFriendByTenantId(tenantId, student.getUserId(),ClientEnum.STUDENT.getCode());
if (toTenantId != null && toTenantId != -1L) {
// 加好友
@@ -977,7 +977,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
});
// 删除好友关系
- imUserFriendService.delFriendByTenantId(teacher.getTenantId(), teacher.getUserId());
+ imUserFriendService.delFriendByTenantId(teacher.getTenantId(), teacher.getUserId(),ClientEnum.TEACHER.getCode());
@@ -236,7 +236,8 @@ public class TenantUnbindRecordServiceImpl extends ServiceImpl<TenantUnbindRecor
log.error("老师解绑审核成功,解散机构群失败:{}", e.getMessage());
- imUserFriendService.delFriendByTenantId(unbindRecord.getUserId(), unbindRecord.getUserId());
+ imUserFriendService.delFriendByTenantId(unbindRecord.getUserId(), unbindRecord.getUserId(),
+ ClientEnum.TEACHER.getCode());
teacherDao.update(null, Wrappers.<Teacher>lambdaUpdate()
.eq(Teacher::getUserId, unbindRecord.getUserId())
@@ -35,7 +35,7 @@
t2.tenant_id_ = #{tenantId} AND
(t1.user_id_ = t2.user_id_ OR t1.friend_id_ = t2.user_id_)
)
- WHERE t1.user_id_ = #{userId}
+ WHERE (t1.user_id_ = #{userId} and t1.client_type_ = #{clientType})
OR t1.friend_id_ = #{userId}
</delete>
</mapper>
@@ -132,7 +132,7 @@ public class OpenStudentController extends BaseController {
// 删除好友
- imUserFriendService.delFriendByTenantId(tenantId, one.getUserId());
+ imUserFriendService.delFriendByTenantId(tenantId, one.getUserId(),ClientEnum.TEACHER.getCode());