Browse Source

更新 'readme.md'

linzhuo 7 years ago
parent
commit
491569c19e
1 changed files with 34 additions and 8 deletions
  1. 34 8
      readme.md

+ 34 - 8
readme.md

@ -220,11 +220,37 @@ Web Socket 客户端在线在推送消息的时候会更新用户的活跃时间
### 相关问题排查处理SQL及处理思路
 
    
           
            
            
-- 查询会话对象
select * from sessions s;
-- 查询成员对象
select * from participants p where session_id='4d5be29f8ba0413d8658441902b958ff_c7a121954a3a4fae84852fd5668b590d_2';
-- 查询咨询消息
select * from muc_messages m;
-- 查询单聊消息
select * from p2p_messages;
-- 查询群组消息
select * from group_messages;
-- 查看系统消息
select * from system_messages;
-- 查看议题对象
select * from topics; 
-- 查询讨论组的医生信息
select s.id,p.participant_id,d.* from participants p,sessions s,doctors d where s.id='4d5be29f8ba0413d8658441902b958ff_c7a121954a3a4fae84852fd5668b590d_2' and  s.id = p.session_id and (d.id = p.participant_id);
-- 查询会话中的患者信息
select s.id,p.participant_id,d.* from participants p,sessions s,patients d where s.id = p.session_id and (d.id = p.participant_id);
-- 查询咨询信息
select t.* from topics t,sessions s where t.session_id = s.id and s.business_type = 2 and s.type = 1;
-- 查询未读消息数量P2P GROUP 相同只是查询的对象不一致                                                                              
select * from muc_messages m,(select p.last_fetch_time,p.session_id from participants p where p.session_id ='4d5be29f8ba0413d8658441902b958ff_c7a121954a3a4fae84852fd5668b590d_2' and p.participant_id='D2016008240003') t where m.session_id ='4d5be29f8ba0413d8658441902b958ff_c7a121954a3a4fae84852fd5668b590d_2' and m.session_id = t.session_id and m.`timestamp`> t.last_fetch_time;
-- 查询某个人的所有会话
select GROUP_CONCAT(p1.participant_id) as 会话的成员集合,s.* from participants p,sessions s,participants p1 where p1.session_id = s.id and  p.session_id = s.id and p.participant_id='D2016008240003' GROUP BY s.id;
-- 查询某个议题的消息
select w.* from  muc_messages w ,(
select m.`timestamp` as begin_date,m2.`timestamp` as end_date,t.session_id from topics t,muc_messages m, muc_messages m2 where m.id = t.start_message_id and m2.id = t.end_message_id and  t.session_id = '4d5be29f8ba0413d8658441902b958ff_c7a121954a3a4fae84852fd5668b590d_2'
) s where w.session_id = s.session_id and w.`timestamp` >= s.begin_date and w.`timestamp`<=s.end_date;