Java Code Examples for org.greenrobot.greendao.query.QueryBuilder#limit()

The following examples show how to use org.greenrobot.greendao.query.QueryBuilder#limit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X8AiLinePointInfoHelper.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public List<X8AiLinePointInfo> getLastItem(int count, int mapType, boolean isFavorites) {
    QueryBuilder<X8AiLinePointInfo> qb = this.lineDao.queryBuilder();
    if (isFavorites) {
        WhereCondition where = Properties.MapType.eq(Integer.valueOf(mapType));
        WhereCondition where1 = Properties.SaveFlag.eq(Integer.valueOf(1));
        qb.where(where, where1).build();
    } else {
        qb.where(Properties.MapType.eq(Integer.valueOf(mapType)), new WhereCondition[0]);
    }
    qb.orderDesc(Properties.Id);
    qb.limit(count);
    return qb.list();
}
 
Example 2
Source File: BaiduNaviDao.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * 获取指定数量的常用(已收藏)地址
 *
 * @param list
 * @param number 指定数量 <=0则搜索全部
 **/
public void getFavorList(List<BaiduAddress> list, int number) {
    if (list == null) {
        return;
    }
    list.clear();
    QueryBuilder<BaiduAddress> queryBuilder = mAddressDao.queryBuilder().where(BaiduAddressDao.Properties.Recyle.eq(0), BaiduAddressDao.Properties.FavoritedTime.isNotNull())
            .orderDesc(BaiduAddressDao.Properties.FavoritedTime);
    if (number > 0) {
        queryBuilder = queryBuilder.limit(number);
    }
    list.addAll(queryBuilder.list());
}
 
Example 3
Source File: BaiduNaviDao.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * 获取指定数量搜索历史记录
 *
 * @param list   待填充的数据集合
 * @param number 指定数量 <=0则搜索全部
 **/
public void getHistoryList(List<BaiduAddress> list, int number) {
    if (list == null) {
        return;
    }
    list.clear();
    QueryBuilder<BaiduAddress> queryBuilder = mAddressDao.queryBuilder().where(BaiduAddressDao.Properties.Disable.eq(0),
            BaiduAddressDao.Properties.SearchKeyWord.isNotNull())
            .orderDesc(BaiduAddressDao.Properties.Created);
    if (number > 0) {
        queryBuilder = queryBuilder.limit(number);
    }
    list.addAll(queryBuilder.list());
}
 
Example 4
Source File: RecordDao.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * 获取指定数量的导航记录
 *
 * @param list   待填充的数据集合
 * @param number 指定数量 <=0则搜索全部
 **/
public void getRecordList(List<NaviRecord> list, int number) {
    if (list == null) {
        return;
    }
    list.clear();
    QueryBuilder<NaviRecord> queryBuilder = mNaviRecordDao.queryBuilder().where(NaviRecordDao.Properties.StartName.isNotNull(), NaviRecordDao.Properties.EndName.isNotNull())
            .orderDesc(NaviRecordDao.Properties.Created);
    if (number > 0) {
        queryBuilder = queryBuilder.limit(number);
    }
    list.addAll(queryBuilder.list());
}
 
Example 5
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * query recommand friend
 *
 * @return
 */
public List<RecommandFriendEntity> loadRecommendEntity(int page, int pageSize) {
    QueryBuilder<RecommandFriendEntity> queryBuilder = recommandFriendEntityDao.queryBuilder();
    queryBuilder.where(RecommandFriendEntityDao.Properties.Status.eq(0)).build();
    queryBuilder.offset((page - 1) * pageSize);
    queryBuilder.limit(pageSize);
    List<RecommandFriendEntity> list = queryBuilder.list();
    Collections.reverse(list);
    return list;
}
 
Example 6
Source File: TransactionHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * The query in recent 10 transfer record
 * @return
 */
public List<TransactionEntity> loadLatelyTrans() {
    QueryBuilder<TransactionEntity> queryBuilder = transactionEntityDao.queryBuilder();
    queryBuilder.limit(10);
    List<TransactionEntity> transEntities = queryBuilder.list();
    if(transEntities != null)
        Collections.reverse(transEntities);
    return transEntities;
}