|
@ -158,7 +158,7 @@ class SessionRepo {
|
|
|
* @param type
|
|
|
* @param handler
|
|
|
*/
|
|
|
static findListByType(userId, type,page,pagesize,status, handler) {
|
|
|
static findListByType(userId, type,page,pagesize,status,name, handler) {
|
|
|
if (page > 0) {
|
|
|
if (page == 1) {
|
|
|
page = 0;
|
|
@ -171,12 +171,16 @@ class SessionRepo {
|
|
|
let sessionSQL;
|
|
|
if (!status){
|
|
|
sessionSQL = "select id, name, type, create_date, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time from "
|
|
|
+ DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type=? order by s.last_message_time desc limit "+page+","+pagesize;
|
|
|
+ DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type=? ";
|
|
|
}
|
|
|
else {
|
|
|
sessionSQL = "select id, name, type, create_date, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time from "
|
|
|
+ DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type=? and s.status="+status+" order by s.last_message_time desc limit "+page+","+pagesize;
|
|
|
+ DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type=? and s.status="+status;
|
|
|
}
|
|
|
if (name){
|
|
|
sessionSQL +=" and name LIKE '%"+name+"%' ";
|
|
|
}
|
|
|
sessionSQL +=" order by s.last_message_time desc limit "+page+","+pagesize;
|
|
|
ImDb.execQuery({
|
|
|
"sql": sessionSQL,
|
|
|
"args": [userId, type],
|