id_, user_id_, friend_id_, friend_nickname_,friend_avatar_, memo_, create_time_, update_time_
INSERT INTO im_user_friend(user_id_, client_type_, friend_id_, friend_type_, friend_nickname_,friend_avatar_, memo_, create_time_, update_time_) VALUES
(#{entity.userId}, #{entity.clientType}, #{entity.friendId}, #{entity.friendType}, #{entity.friendNickname}, #{entity.friendAvatar}, #{entity.memo}, #{entity.createTime}, #{entity.updateTime})
ON DUPLICATE KEY UPDATE user_id_ = VALUES(user_id_), client_type_ = VALUES(client_type_), friend_id_ = VALUES(friend_id_), friend_type_ = VALUES(friend_type_)
DELETE t1
FROM im_user_friend t1
LEFT JOIN teacher t2 ON t1.friend_id_ = t2.user_id_
LEFT JOIN teacher t3 ON t1.user_id_ = t3.user_id_
WHERE (t1.user_id_ = #{userId} and t1.client_type_ = #{clientType} and t2.tenant_id_ = #{tenantId})
OR (t1.friend_id_ = #{userId} and t1.friend_type_ = #{clientType} and t3.tenant_id_ = #{tenantId})
DELETE t1
FROM im_user_friend t1
LEFT JOIN student t2 ON t1.friend_id_ = t2.user_id_
LEFT JOIN student t3 ON t1.user_id_ = t3.user_id_
WHERE (t1.user_id_ = #{userId} and t1.client_type_ = #{clientType} and t2.tenant_id_ = #{tenantId})
OR (t1.friend_id_ = #{userId} and t1.friend_type_ = #{clientType} and t3.tenant_id_ = #{tenantId})