瀏覽代碼

MDT 相关BUG改造提交

huangwenjie 5 年之前
父節點
當前提交
8cc4d68651
共有 1 個文件被更改,包括 35 次插入15 次删除
  1. 35 15
      src/server/repository/mysql/session.repo.js

+ 35 - 15
src/server/repository/mysql/session.repo.js

@ -233,25 +233,45 @@ class SessionRepo {
    static findAllByType(userId, businessType,page,pagesize, handler) {
        if (page > 0) {
            if (page == 1) {
                page = 0;
                page = 0;d
            }else{
                page = (parseInt(page)-1) * parseInt(pagesize);
            }
        }
        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";
        //中山医院无法查询到所有会话记录,暂时取消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;
        ImDb.execQuery({
            "sql": sessionSQL,
            "args": [userId, businessType],
            "handler": handler || function (err, res) {
                if(err) log.error(err);
            }
        });
        // MDT 不执行 businessType 的过滤查询 20191028
        if(businessType){
            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";
            //中山医院无法查询到所有会话记录,暂时取消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;
            ImDb.execQuery({
                "sql": sessionSQL,
                "args": [userId, businessType],
                "handler": handler || function (err, res) {
                    if(err) log.error(err);
                }
            });
        }else{
            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";
            //中山医院无法查询到所有会话记录,暂时取消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.type!=0 limit "+page+","+pagesize;
            ImDb.execQuery({
                "sql": sessionSQL,
                "args": [userId],
                "handler": handler || function (err, res) {
                    if(err) log.error(err);
                }
            });
        }
    }