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

The following examples show how to use org.greenrobot.greendao.query.QueryBuilder#list() . 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: ChineseCityEntityController.java    From GeometricWeather with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Nullable
public ChineseCityEntity selectChineseCityEntity(@NonNull String name) {
    if (TextUtils.isEmpty(name)) {
        return null;
    }

    ChineseCityEntityDao dao = getSession().getChineseCityEntityDao();

    QueryBuilder<ChineseCityEntity> builder = dao.queryBuilder();
    builder.whereOr(
            ChineseCityEntityDao.Properties.District.eq(name),
            ChineseCityEntityDao.Properties.City.eq(name)
    );

    List<ChineseCityEntity> entityList = builder.list();
    if (entityList == null || entityList.size() <= 0) {
        return null;
    } else {
        return entityList.get(0);
    }
}
 
Example 2
Source File: DbDwonUtil.java    From RxjavaRetrofitDemo-string-master with MIT License 5 votes vote down vote up
public DownInfo queryDownBy(long Id) {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    DownInfoDao downInfoDao = daoSession.getDownInfoDao();
    QueryBuilder<DownInfo> qb = downInfoDao.queryBuilder();
    qb.where(DownInfoDao.Properties.Id.eq(Id));
    List<DownInfo> list = qb.list();
    if(list.isEmpty()){
        return null;
    }else{
        return list.get(0);
    }
}
 
Example 3
Source File: ConversionSettingHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * Pub_key query friend
 * @return
 */
public ConversionSettingEntity loadSetEntity(String pubkey) {
    QueryBuilder<ConversionSettingEntity> queryBuilder = conversionSettingEntityDao.queryBuilder();
    queryBuilder.where(ConversionSettingEntityDao.Properties.Identifier.eq(pubkey)).build();
    List<ConversionSettingEntity> settingEntities = queryBuilder.list();
    return settingEntities.size() == 0 ? null : settingEntities.get(0);
}
 
Example 4
Source File: DbDownUtil.java    From Bailan with Apache License 2.0 5 votes vote down vote up
public List<DownInfo> queryDownAll() {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    DownInfoDao downInfoDao = daoSession.getDownInfoDao();
    QueryBuilder<DownInfo> qb = downInfoDao.queryBuilder();
    return qb.list();
}
 
Example 5
Source File: DbDwonUtil.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
public DownInfo queryDownBy(long Id) {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    DownInfoDao downInfoDao = daoSession.getDownInfoDao();
    QueryBuilder<DownInfo> qb = downInfoDao.queryBuilder();
    qb.where(DownInfoDao.Properties.Id.eq(Id));
    List<DownInfo> list = qb.list();
    if(list.isEmpty()){
        return null;
    }else{
        return list.get(0);
    }
}
 
Example 6
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * query friend request
 *
 * @return
 */
public FriendRequestEntity loadFriendRequest(String address) {
    QueryBuilder<FriendRequestEntity> queryBuilder = friendRequestEntityDao.queryBuilder();
    queryBuilder.where(FriendRequestEntityDao.Properties.Address.eq(address)).limit(1).build();
    List<FriendRequestEntity> list = queryBuilder.list();
    if (list.size() == 0) {
        return null;
    }
    return list.get(0);
}
 
Example 7
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * Fuzzy query the contact
 *
 * @param text
 * @return
 */
public List<ContactEntity> loadFriendEntityFromText(String text) {
    QueryBuilder<ContactEntity> queryBuilder = contactEntityDao.queryBuilder();
    queryBuilder.where(ContactEntityDao.Properties.Username.like(text + "%")).limit(1).build();
    List<ContactEntity> friendEntities = queryBuilder.list();
    return friendEntities;
}
 
Example 8
Source File: CookieDbUtil.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
public List<CookieResulte> queryCookieAll() {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    CookieResulteDao downInfoDao = daoSession.getCookieResulteDao();
    QueryBuilder<CookieResulte> qb = downInfoDao.queryBuilder();
    return qb.list();
}
 
Example 9
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
public void inserRecommendEntity(RecommandFriendEntity entity) {
    QueryBuilder<RecommandFriendEntity> qb = recommandFriendEntityDao.queryBuilder();
    qb.where(RecommandFriendEntityDao.Properties.Pub_key.eq(entity.getPub_key()));
    List<RecommandFriendEntity> list = qb.list();
    if (list.size() > 0) {
        return;
    }
    entity.setStatus(0);
    recommandFriendEntityDao.insert(entity);
}
 
Example 10
Source File: DbDwonUtil.java    From RxRetrofit-mvp with MIT License 5 votes vote down vote up
public List<DownInfo> queryDownAll() {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    DownInfoDao downInfoDao = daoSession.getDownInfoDao();
    QueryBuilder<DownInfo> qb = downInfoDao.queryBuilder();
    return qb.list();
}
 
Example 11
Source File: DbDownUtil.java    From RxjavaRetrofitDemo-master with MIT License 5 votes vote down vote up
public List<DownInfo> queryDownAll() {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    DownInfoDao downInfoDao = daoSession.getDownInfoDao();
    QueryBuilder<DownInfo> qb = downInfoDao.queryBuilder();
    return qb.list();
}
 
Example 12
Source File: ParamHelper.java    From Android with MIT License 5 votes vote down vote up
public ParamEntity loadParamEntityKeyExt(String key, String ext) {
    QueryBuilder<ParamEntity> queryBuilder = paramEntityDao.queryBuilder();
    queryBuilder.where(ParamEntityDao.Properties.Key.eq(key), ParamEntityDao.Properties.Ext.eq(ext)).limit(1).build();
    List<ParamEntity> paramEntities = queryBuilder.list();
    if (null == paramEntities || paramEntities.size() == 0) {
        return null;
    }
    return paramEntities.get(0);
}
 
Example 13
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * group member
 *
 * @param pukkey
 * @param address
 * @return
 */
public GroupMemberEntity loadGroupMemByAds(String pukkey, String address) {
    QueryBuilder<GroupMemberEntity> queryBuilder = groupMemberEntityDao.queryBuilder();
    queryBuilder.where(GroupMemberEntityDao.Properties.Identifier.eq(pukkey),
            GroupMemberEntityDao.Properties.Address.eq(address)).build();
    List<GroupMemberEntity> memEntities = queryBuilder.list();
    return (memEntities == null || memEntities.size() == 0) ? null : memEntities.get(0);
}
 
Example 14
Source File: MessageHelper.java    From Android with MIT License 5 votes vote down vote up
public MessageEntity loadMsgByMsgid(String msgid) {
    QueryBuilder<MessageEntity> queryBuilder = messageEntityDao.queryBuilder();
    queryBuilder.where(MessageEntityDao.Properties.Message_id.eq(msgid)).limit(1).build();
    List<MessageEntity> detailEntities = queryBuilder.list();
    if (detailEntities.size() == 0) {
        return null;
    }
    return detailEntities.get(0);
}
 
Example 15
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 16
Source File: DbDwonUtil.java    From Rx-Retrofit with MIT License 5 votes vote down vote up
public DownInfo queryDownBy(long Id) {
    DaoMaster daoMaster = new DaoMaster(getReadableDatabase());
    DaoSession daoSession = daoMaster.newSession();
    DownInfoDao downInfoDao = daoSession.getDownInfoDao();
    QueryBuilder<DownInfo> qb = downInfoDao.queryBuilder();
    qb.where(DownInfoDao.Properties.Id.eq(Id));
    List<DownInfo> list = qb.list();
    if(list.isEmpty()){
        return null;
    }else{
        return list.get(0);
    }
}
 
Example 17
Source File: DBManager.java    From android-open-framework-analysis with Apache License 2.0 4 votes vote down vote up
public List<User> listAllData() {
    DaoSession session = new DaoMaster(getWriteableDatabase()).newSession();
    QueryBuilder<User> queryBuilder = session.getUserDao().queryBuilder();
    return queryBuilder.list();
}
 
Example 18
Source File: ConversionHelper.java    From Android with MIT License 4 votes vote down vote up
public ConversionEntity loadRoomEnitity(String roomid) {
    QueryBuilder<ConversionEntity> queryBuilder = conversionEntityDao.queryBuilder();
    queryBuilder.where(ConversionEntityDao.Properties.Identifier.eq(roomid)).limit(1).build();
    List<ConversionEntity> roomEntities = queryBuilder.list();
    return (roomEntities == null || roomEntities.size() == 0) ? null : roomEntities.get(0);
}
 
Example 19
Source File: X8AiLinePointInfoHelper.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public List<X8AiLinePointLatlngInfo> getLatlngByLineId(int mapType, long lineId) {
    QueryBuilder<X8AiLinePointLatlngInfo> qb = this.pointDao.queryBuilder();
    qb.where(X8AiLinePointLatlngInfoDao.Properties.LineId.eq(Long.valueOf(lineId)), new WhereCondition[0]);
    return qb.list();
}
 
Example 20
Source File: DataStasicInfoHelper.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public List<DataStaticInfo> queryX9UseTime() {
    QueryBuilder<DataStaticInfo> qb = this.dao.queryBuilder();
    qb.where(Properties.Type.eq(Integer.valueOf(0)), new WhereCondition[0]).where(Properties.DeviceType.eq(Integer.valueOf(0)), new WhereCondition[0]);
    return qb.list();
}