Commit ec9a1154 by hweeeeeei

修复bug:返回已存在的一对一会话id

parent 61ed7094
......@@ -77,7 +77,7 @@ public interface ImConversationMapper extends BaseMapper<ImConversation> {
/**
* 查询已经存在的会话信息
* 查询已经存在的一对一会话信息
*
* @param clientId1
* @param clientId2
......
......@@ -135,7 +135,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
if (repetitionConversation != 0) {
log.info("repetitionConversation != 0");
// 返回已存在的会话id
// 返回已存在的一对一会话id
ImConversation repetitionConversationInfo = imConversationMapper.getRepetitionConversationInfo(createClient.getId(), client2.getId());
ImConversationCreateVo imConversationCreateVo = new ImConversationCreateVo();
imConversationCreateVo.setId(repetitionConversationInfo.getId());
......
......@@ -92,14 +92,19 @@
<select id="getRepetitionConversationInfo" resultType="com.wecloud.im.entity.ImConversation">
SELECT im_conversation.*
SELECT im_conversation.*,
(SELECT COUNT(im2.id)
FROM im_conversation_members AS im2
WHERE im2.fk_conversation_id = im_conversation_members.fk_conversation_id) AS members_count
FROM im_conversation_members
INNER JOIN (SELECT *
FROM im_conversation_members
WHERE im_conversation_members.fk_client_id = #{clientId2}) AS im_conversation_members2
ON im_conversation_members.fk_conversation_id = im_conversation_members2.fk_conversation_id
INNER JOIN im_conversation ON im_conversation.id = im_conversation_members.fk_conversation_id
WHERE im_conversation_members.fk_client_id = #{clientId1} LIMIT 1
WHERE im_conversation_members.fk_client_id = #{clientId1}
HAVING members_count = 2 LIMIT 1
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment