1

我正在使用Sugar ORm并且需要使用以下查询:

public void selectByfriendId(String fId , int lastMsgId){
   select from table where (senderId = fId or receiverId = fId) and 
                           ( show = "1" and msg_Id > lastMsgId)
}

That5 是我的方法:

public List<Chat> selectById(String cId , String fId , int lastMsgId){
    Select showChats = Select.from(Chat.class)
            .where(Condition.prop("senderid").eq(fId) ,
            Condition.prop("show").eq("1") , Condition.prop("msg_Id").gt(lastMsgId))
            .or(Condition.prop("receiverid").eq(fId), Condition.prop("show").eq("1") , 
            Condition.prop("msg_Id").gt(lastMsgId));
    Log.v(G.Logs.DB , "MessagesStack DataBase.SelectById showChats.list().size : " + showChats.list().size());
    return  showChats.list();
}

并尝试了这个:

    List<Chat> array = Chat.find(Chat.class , "(senderid = ? OR receiverid = ?) AND (show = ? AND msg_Id > ?)", fId , fId , "1" , ""+lastMsgId);

但它显示了表格中的整行

4

0 回答 0