Browse Source

修改查询居民所有会话时,取消角色过滤条件。

shenzaixin 5 years ago
parent
commit
56335b538c
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/server/repository/mysql/session.repo.js

+ 7 - 1
src/server/repository/mysql/session.repo.js

@ -176,6 +176,7 @@ class SessionRepo {
                    " where ((s.id in(" + sql + ") and s.business_type = ? and s.status = 1) or (s.id in(" + sql1 + ") and s.business_type = ? and s.status = 0)) " +
                    // " and s.id = p.session_id and p.participant_id = ? ORDER BY (p.last_fetch_time - s.last_message_time+1)>0,s.create_date desc limit "+page+","+pagesize;
                    " and s.id = p.session_id and p.participant_id = ? ORDER BY s.last_message_time desc limit "+page+","+pagesize;
                log.info("1."+sessionSQL);
                ImDb.execQuery({
                    "sql": sessionSQL,
                    "args": [userId, businessType,userId,businessType,userId],
@ -190,6 +191,7 @@ class SessionRepo {
                let sql1 = ("select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role ="+PARTICIPANT_ROLES.REGULAR+" group by w.session_id")
                sessionSQL =  "select * from "
                    + DB_TABLES.Sessions + " s where (s.id in(" + sql + ") and s.business_type = ? and s.status = 1) or (s.id in(" + sql1 + ") and s.business_type = ? and s.status = 0) limit "+page+","+pagesize;
                log.info("2."+sessionSQL);
                ImDb.execQuery({
                    "sql": sessionSQL,
                    "args": [userId, businessType,userId,businessType],
@ -204,6 +206,7 @@ class SessionRepo {
            sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role ="+PARTICIPANT_ROLES.HOST+" group by w.session_id";
            sessionSQL =  "select * from "
                + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.business_type = ? and s.status = ? limit "+page+","+pagesize;
            log.info("3."+sessionSQL);
            ImDb.execQuery({
                "sql": sessionSQL,
                "args": [userId, businessType,status],
@ -225,9 +228,12 @@ class SessionRepo {
        }
        let sessionSQL ="";
        let sql ="";
        sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role ="+PARTICIPANT_ROLES.HOST+" group by w.session_id";
        //sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? and participant_role ="+PARTICIPANT_ROLES.HOST+" group by w.session_id";
        //中山医院无法查询到所有会话记录,暂时取消participant_role的判断条件 20190619 
        sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? group by w.session_id";
        sessionSQL =  "select * from "
            + DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.business_type = ? and s.type!=0 limit "+page+","+pagesize;
        log.info("findAllByType:"+sessionSQL);
        ImDb.execQuery({
            "sql": sessionSQL,
            "args": [userId, businessType],