|
|
- sqlStr = "SELECT IF ( b.nickname = '', CONCAT(SUBSTR( b.phone, 1, 3 ),'****',SUBSTR( b.phone, 8, 11)), b.nickname ) AS name, b.id, e.title, b.headimg, e.type, e.link, e.content, a.create_time, ( SELECT count( h.id ) FROM socialize_message_mailbox h left join socialize_chat_session i ON a.own_type = 1 AND a.own_id = i.id WHERE h.own_type = 1 AND i.id=f.id AND h.isread = 0 ) AS number FROM socialize_message_mailbox a LEFT JOIN base_user b ON a.own_type=2 and b.id = a.own_id LEFT JOIN socialize_message e ON e.id = a.messag_id LEFT JOIN socialize_chat_session f ON a.own_type=1 and a.own_id=f.id WHERE a.id IN (" + customerMessageId + ")" + phoneSql + " ORDER BY a.create_time DESC"
|
|
|
+ sqlStr = "SELECT IF ( b.nickname = '', CONCAT(SUBSTR( b.phone, 1, 3 ),'****',SUBSTR( b.phone, 8, 11)), b.nickname ) AS name, b.id, e.title, b.headimg, e.type, e.link, e.content, a.create_time, ( SELECT count( h.id ) FROM socialize_message_mailbox h left join socialize_chat_session i ON h.own_type = 1 AND h.own_id = i.id WHERE h.own_type = 1 AND i.ent_id=f.ent_id and i.user_id=f.user_id AND h.isread = 0 ) AS number FROM socialize_message_mailbox a LEFT JOIN base_user b ON if (a.send_user_type=1 ,a.receive_user_id=b.id,a.send_user_id=b.id) LEFT JOIN socialize_message e ON e.id = a.messag_id LEFT JOIN socialize_chat_session f ON a.own_type=1 and a.own_id=f.id WHERE a.id IN (" + customerMessageId + ")" + phoneSql + " ORDER BY a.create_time DESC"
|