|
@ -190,7 +190,7 @@ class SessionRepo {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
static findAllByTypeAndStatus(userId, businessType,status,page,pagesize, handler) {
|
|
|
|
|
|
static findAllByTypeAndStatus(userId,sessionType, businessType,status,page,pagesize, handler) {
|
|
if (page > 0) {
|
|
if (page > 0) {
|
|
if (page == 1) {
|
|
if (page == 1) {
|
|
page = 0;
|
|
page = 0;
|
|
@ -206,10 +206,16 @@ class SessionRepo {
|
|
sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? group by w.session_id";
|
|
sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id = ? group by w.session_id";
|
|
//找出角色讨论组中为旁听且未结束的咨询
|
|
//找出角色讨论组中为旁听且未结束的咨询
|
|
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")
|
|
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 s.* from " + DB_TABLES.Sessions + " s, " + DB_TABLES.Participants + " p " +
|
|
|
|
" 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;
|
|
|
|
|
|
if(sessionType){
|
|
|
|
sessionSQL = "select s.* from " + DB_TABLES.Sessions + " s, " + DB_TABLES.Participants + " p " +
|
|
|
|
" where s.type='"+sessionType+"' and ((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 s.last_message_time desc limit "+page+","+pagesize;
|
|
|
|
}else {
|
|
|
|
sessionSQL = "select s.* from " + DB_TABLES.Sessions + " s, " + DB_TABLES.Participants + " p " +
|
|
|
|
" 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 s.last_message_time desc limit "+page+","+pagesize;
|
|
|
|
}
|
|
|
|
|
|
log.info("1."+sessionSQL);
|
|
log.info("1."+sessionSQL);
|
|
ImDb.execQuery({
|
|
ImDb.execQuery({
|
|
"sql": sessionSQL,
|
|
"sql": sessionSQL,
|