|
@ -233,25 +233,45 @@ class SessionRepo {
|
|
static findAllByType(userId, businessType,page,pagesize, handler) {
|
|
static findAllByType(userId, businessType,page,pagesize, handler) {
|
|
if (page > 0) {
|
|
if (page > 0) {
|
|
if (page == 1) {
|
|
if (page == 1) {
|
|
page = 0;
|
|
|
|
|
|
page = 0;d
|
|
}else{
|
|
}else{
|
|
page = (parseInt(page)-1) * parseInt(pagesize);
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|