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

The following examples show how to use org.greenrobot.greendao.query.Query#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: DeviceDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "devices" to-many relationship of Student. */
public List<Device> _queryStudent_Devices(long studentId) {
    synchronized (this) {
        if (student_DevicesQuery == null) {
            QueryBuilder<Device> queryBuilder = queryBuilder();
            queryBuilder.join(JoinStudentsWithDevices.class, JoinStudentsWithDevicesDao.Properties.DeviceId)
                .where(JoinStudentsWithDevicesDao.Properties.StudentId.eq(studentId));
            student_DevicesQuery = queryBuilder.build();
        }
    }
    Query<Device> query = student_DevicesQuery.forCurrentThread();
    query.setParameter(0, studentId);
    return query.list();
}
 
Example 2
Source File: StudentImageDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "studentImages" to-many relationship of StudentImageCollectionEvent. */
public List<StudentImage> _queryStudentImageCollectionEvent_StudentImages(long studentImageCollectionEventId) {
    synchronized (this) {
        if (studentImageCollectionEvent_StudentImagesQuery == null) {
            QueryBuilder<StudentImage> queryBuilder = queryBuilder();
            queryBuilder.where(Properties.StudentImageCollectionEventId.eq(null));
            studentImageCollectionEvent_StudentImagesQuery = queryBuilder.build();
        }
    }
    Query<StudentImage> query = studentImageCollectionEvent_StudentImagesQuery.forCurrentThread();
    query.setParameter(0, studentImageCollectionEventId);
    return query.list();
}
 
Example 3
Source File: NumberDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "numbers" to-many relationship of Video. */
public List<Number> _queryVideo_Numbers(long videoId) {
    synchronized (this) {
        if (video_NumbersQuery == null) {
            QueryBuilder<Number> queryBuilder = queryBuilder();
            queryBuilder.join(JoinVideosWithNumbers.class, JoinVideosWithNumbersDao.Properties.NumberId)
                .where(JoinVideosWithNumbersDao.Properties.VideoId.eq(videoId));
            video_NumbersQuery = queryBuilder.build();
        }
    }
    Query<Number> query = video_NumbersQuery.forCurrentThread();
    query.setParameter(0, videoId);
    return query.list();
}
 
Example 4
Source File: LetterDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "letters" to-many relationship of Audio. */
public List<Letter> _queryAudio_Letters(long audioId) {
    synchronized (this) {
        if (audio_LettersQuery == null) {
            QueryBuilder<Letter> queryBuilder = queryBuilder();
            queryBuilder.join(JoinAudiosWithLetters.class, JoinAudiosWithLettersDao.Properties.LetterId)
                .where(JoinAudiosWithLettersDao.Properties.AudioId.eq(audioId));
            audio_LettersQuery = queryBuilder.build();
        }
    }
    Query<Letter> query = audio_LettersQuery.forCurrentThread();
    query.setParameter(0, audioId);
    return query.list();
}
 
Example 5
Source File: NumberDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "numbers" to-many relationship of Image. */
public List<Number> _queryImage_Numbers(long imageId) {
    synchronized (this) {
        if (image_NumbersQuery == null) {
            QueryBuilder<Number> queryBuilder = queryBuilder();
            queryBuilder.join(JoinImagesWithNumbers.class, JoinImagesWithNumbersDao.Properties.NumberId)
                .where(JoinImagesWithNumbersDao.Properties.ImageId.eq(imageId));
            image_NumbersQuery = queryBuilder.build();
        }
    }
    Query<Number> query = image_NumbersQuery.forCurrentThread();
    query.setParameter(0, imageId);
    return query.list();
}
 
Example 6
Source File: LetterDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "letters" to-many relationship of Image. */
public List<Letter> _queryImage_Letters(long imageId) {
    synchronized (this) {
        if (image_LettersQuery == null) {
            QueryBuilder<Letter> queryBuilder = queryBuilder();
            queryBuilder.join(JoinImagesWithLetters.class, JoinImagesWithLettersDao.Properties.LetterId)
                .where(JoinImagesWithLettersDao.Properties.ImageId.eq(imageId));
            image_LettersQuery = queryBuilder.build();
        }
    }
    Query<Letter> query = image_LettersQuery.forCurrentThread();
    query.setParameter(0, imageId);
    return query.list();
}
 
Example 7
Source File: LetterDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "letters" to-many relationship of Audio. */
public List<Letter> _queryAudio_Letters(long audioId) {
    synchronized (this) {
        if (audio_LettersQuery == null) {
            QueryBuilder<Letter> queryBuilder = queryBuilder();
            queryBuilder.join(JoinAudiosWithLetters.class, JoinAudiosWithLettersDao.Properties.LetterId)
                .where(JoinAudiosWithLettersDao.Properties.AudioId.eq(audioId));
            audio_LettersQuery = queryBuilder.build();
        }
    }
    Query<Letter> query = audio_LettersQuery.forCurrentThread();
    query.setParameter(0, audioId);
    return query.list();
}
 
Example 8
Source File: AllophoneDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "allophones" to-many relationship of Letter. */
public List<Allophone> _queryLetter_Allophones(long letterId) {
    synchronized (this) {
        if (letter_AllophonesQuery == null) {
            QueryBuilder<Allophone> queryBuilder = queryBuilder();
            queryBuilder.join(JoinLettersWithAllophones.class, JoinLettersWithAllophonesDao.Properties.AllophoneId)
                .where(JoinLettersWithAllophonesDao.Properties.LetterId.eq(letterId));
            letter_AllophonesQuery = queryBuilder.build();
        }
    }
    Query<Allophone> query = letter_AllophonesQuery.forCurrentThread();
    query.setParameter(0, letterId);
    return query.list();
}
 
Example 9
Source File: NumberDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "numbers" to-many relationship of Video. */
public List<Number> _queryVideo_Numbers(long videoId) {
    synchronized (this) {
        if (video_NumbersQuery == null) {
            QueryBuilder<Number> queryBuilder = queryBuilder();
            queryBuilder.join(JoinVideosWithNumbers.class, JoinVideosWithNumbersDao.Properties.NumberId)
                .where(JoinVideosWithNumbersDao.Properties.VideoId.eq(videoId));
            video_NumbersQuery = queryBuilder.build();
        }
    }
    Query<Number> query = video_NumbersQuery.forCurrentThread();
    query.setParameter(0, videoId);
    return query.list();
}
 
Example 10
Source File: NewsChannelTableManager.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
/**
     *  加载 推荐频道
     * @return 推荐频道列表
     */
    public static List<NewsChannelTable> loadNewsChannelsRecommend(){
        Query<NewsChannelTable> newsChannelTableQuery = MyApplication.getDaoSession().getNewsChannelTableDao()
                .queryBuilder()
                .where(NewsChannelTableDao.Properties.NewsChannelSelect.eq(false))
                .orderAsc(NewsChannelTableDao.Properties.NewsChannelIndex)
                .build();
        return newsChannelTableQuery.list();
//        return DBManager.init(MyApplication.getInstance()).loadNewsChannels("0");
    }
 
Example 11
Source File: WordDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "words" to-many relationship of Audio. */
public List<Word> _queryAudio_Words(long audioId) {
    synchronized (this) {
        if (audio_WordsQuery == null) {
            QueryBuilder<Word> queryBuilder = queryBuilder();
            queryBuilder.join(JoinAudiosWithWords.class, JoinAudiosWithWordsDao.Properties.WordId)
                .where(JoinAudiosWithWordsDao.Properties.AudioId.eq(audioId));
            audio_WordsQuery = queryBuilder.build();
        }
    }
    Query<Word> query = audio_WordsQuery.forCurrentThread();
    query.setParameter(0, audioId);
    return query.list();
}
 
Example 12
Source File: NumberDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "numbers" to-many relationship of Audio. */
public List<Number> _queryAudio_Numbers(long audioId) {
    synchronized (this) {
        if (audio_NumbersQuery == null) {
            QueryBuilder<Number> queryBuilder = queryBuilder();
            queryBuilder.join(JoinAudiosWithNumbers.class, JoinAudiosWithNumbersDao.Properties.NumberId)
                .where(JoinAudiosWithNumbersDao.Properties.AudioId.eq(audioId));
            audio_NumbersQuery = queryBuilder.build();
        }
    }
    Query<Number> query = audio_NumbersQuery.forCurrentThread();
    query.setParameter(0, audioId);
    return query.list();
}
 
Example 13
Source File: PlayBeanDao.java    From likequanmintv with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "list" to-many relationship of LiveCategory. */
public List<PlayBean> _queryLiveCategory_List(Long livecategory_id) {
    synchronized (this) {
        if (liveCategory_ListQuery == null) {
            QueryBuilder<PlayBean> queryBuilder = queryBuilder();
            queryBuilder.where(Properties.Livecategory_id.eq(null));
            liveCategory_ListQuery = queryBuilder.build();
        }
    }
    Query<PlayBean> query = liveCategory_ListQuery.forCurrentThread();
    query.setParameter(0, livecategory_id);
    return query.list();
}
 
Example 14
Source File: CourseV2Dao.java    From ClassSchedule with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "cgItems" to-many relationship of CourseGroup. */
public List<CourseV2> _queryCourseGroup_CgItems(Long couCgId) {
    synchronized (this) {
        if (courseGroup_CgItemsQuery == null) {
            QueryBuilder<CourseV2> queryBuilder = queryBuilder();
            queryBuilder.where(Properties.CouCgId.eq(null));
            courseGroup_CgItemsQuery = queryBuilder.build();
        }
    }
    Query<CourseV2> query = courseGroup_CgItemsQuery.forCurrentThread();
    query.setParameter(0, couCgId);
    return query.list();
}
 
Example 15
Source File: LetterDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
/** Internal query to resolve the "letters" to-many relationship of Image. */
public List<Letter> _queryImage_Letters(long imageId) {
    synchronized (this) {
        if (image_LettersQuery == null) {
            QueryBuilder<Letter> queryBuilder = queryBuilder();
            queryBuilder.join(JoinImagesWithLetters.class, JoinImagesWithLettersDao.Properties.LetterId)
                .where(JoinImagesWithLettersDao.Properties.ImageId.eq(imageId));
            image_LettersQuery = queryBuilder.build();
        }
    }
    Query<Letter> query = image_LettersQuery.forCurrentThread();
    query.setParameter(0, imageId);
    return query.list();
}
 
Example 16
Source File: LocalKinoRepository.java    From CineLog with GNU General Public License v3.0 5 votes vote down vote up
public LocalKino findByMovieId(long movieId) {
    Query<LocalKino> localKinoQuery = dao.queryBuilder()
            .where(LocalKinoDao.Properties.Tmdb_id.eq(movieId))
            .limit(1)
            .build();
    List<LocalKino> localKinos = localKinoQuery.list();
    return localKinos != null && localKinos.size() > 0 ? localKinos.get(0) : null;
}
 
Example 17
Source File: WishlistMovieRepository.java    From CineLog with GNU General Public License v3.0 5 votes vote down vote up
public WishlistMovie findByTmdbId(long movieId) {
    Query<WishlistMovie> wishlistMovieQuery = dao.queryBuilder()
            .where(WishlistMovieDao.Properties.Tmdb_id.eq(movieId))
            .limit(1)
            .build();
    List<WishlistMovie> wishlistMovies = wishlistMovieQuery.list();
    return wishlistMovies != null && wishlistMovies.size() > 0 ? wishlistMovies.get(0) : null;
}
 
Example 18
Source File: NewsChannelTableManager.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
/**
 *  查询 index > ?  频道
 * @param index
 */
public static List<NewsChannelTable> loadNewsChannelsIndexGt(int index){
    Query<NewsChannelTable> newsChannelTableQuery = MyApplication.getDaoSession().getNewsChannelTableDao().queryBuilder()
            .where(NewsChannelTableDao.Properties.NewsChannelIndex.gt(index)).build();
    return newsChannelTableQuery.list();
    //return DBManager.init(MyApplication.getInstance()).loadNewsChannelsByWhere(" news_channel_index > ? ",new String[]{index+""});
}
 
Example 19
Source File: SerieEpisodeRepository.java    From CineLog with GNU General Public License v3.0 4 votes vote down vote up
public List<SerieEpisode> findByTmdbSerieId(long tmdbSerieId) {
    Query<SerieEpisode> serieEpisodeQuery = dao.queryBuilder()
            .where(SerieEpisodeDao.Properties.Tmdb_id.eq(tmdbSerieId))
            .build();
    return serieEpisodeQuery.list();
}
 
Example 20
Source File: MainActivity.java    From GreenDAO3_Demo with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    setSupportActionBar(mToolbar);
    mToolbar.setTitleTextColor(Color.WHITE);

    //当前数据库版本
    KLog.w("db version: " + DaoMaster.SCHEMA_VERSION);

    mFastAdapter = new GenericFastItemAdapter<>(new Function<Student, StudentItem>() {
        @Override
        public StudentItem apply(Student student) {
            return new StudentItem(student);
        }
    });

    mStudents = new ArrayList<>();

    mRandom = new Random();

    GridLayoutManager manager = new GridLayoutManager(this, 1);
    manager.setSpanSizeLookup(new GridLayoutManager.DefaultSpanSizeLookup());


    mRvMain.setAdapter(mFastAdapter);
    mRvMain.setLayoutManager(manager);

    mHelper = DbUtil.getDriverHelper();

    //读取所有学生
    dbStudents = mHelper.queryAll();

    //把学生信息显示到界面
    for (Student s : dbStudents) {
        Student item = new Student();
        item.id = s.getId();
        item.name = s.getName();
        item.age = s.getAge();
        item.number = s.getNumber();
        item.score = s.getScore();

        KLog.w("db: " + item.id + ", "
                + item.age + ", " + item.name + ", "
                + item.number
        );

        mStudents.add(item);
    }
    mFastAdapter.addModel(mStudents);

    //获取age大于20的数据
    Query<Student> query = mHelper.queryBuilder()
            .where(StudentDao.Properties.Age.ge("20"))
            .build();
    dbStudents = query.list();

}