Search in sources :

Example 1 with SearchHistoryDao

use of cn.nicolite.palm300heroes.db.dao.SearchHistoryDao in project Palm300Heroes by nicolite.

the class SearchPresenter method showHistory.

public void showHistory(int type) {
    SearchHistoryDao searchHistoryDao = daoSession.getSearchHistoryDao();
    List<SearchHistory> list = searchHistoryDao.queryBuilder().where(SearchHistoryDao.Properties.Type.eq(type)).orderDesc(SearchHistoryDao.Properties.Id).list();
    if (getView() != null) {
        getView().showHistory(list);
    }
}
Also used : SearchHistoryDao(cn.nicolite.palm300heroes.db.dao.SearchHistoryDao) SearchHistory(cn.nicolite.palm300heroes.model.bean.SearchHistory)

Example 2 with SearchHistoryDao

use of cn.nicolite.palm300heroes.db.dao.SearchHistoryDao in project Palm300Heroes by nicolite.

the class SearchPresenter method deleteHistoryItem.

public void deleteHistoryItem(SearchHistory history) {
    SearchHistoryDao searchHistoryDao = daoSession.getSearchHistoryDao();
    searchHistoryDao.delete(history);
}
Also used : SearchHistoryDao(cn.nicolite.palm300heroes.db.dao.SearchHistoryDao)

Example 3 with SearchHistoryDao

use of cn.nicolite.palm300heroes.db.dao.SearchHistoryDao in project Palm300Heroes by nicolite.

the class SearchPresenter method addHistory.

public void addHistory(int type, String history) {
    if (TextUtils.isEmpty(history)) {
        if (getView() != null) {
            getView().showMessage("你还没有输入搜索内容!");
        }
        return;
    }
    SearchHistoryDao searchHistoryDao = daoSession.getSearchHistoryDao();
    List<SearchHistory> list = searchHistoryDao.queryBuilder().where(SearchHistoryDao.Properties.Type.eq(type), SearchHistoryDao.Properties.History.eq(history)).list();
    if (!ListUtils.isEmpty(list)) {
        for (SearchHistory searchHistory : list) {
            searchHistoryDao.delete(searchHistory);
        }
    }
    SearchHistory searchHistory = new SearchHistory();
    searchHistory.setType(type);
    searchHistory.setHistory(history);
    searchHistoryDao.insert(searchHistory);
    showHistory(type);
}
Also used : SearchHistoryDao(cn.nicolite.palm300heroes.db.dao.SearchHistoryDao) SearchHistory(cn.nicolite.palm300heroes.model.bean.SearchHistory)

Example 4 with SearchHistoryDao

use of cn.nicolite.palm300heroes.db.dao.SearchHistoryDao in project Palm300Heroes by nicolite.

the class SearchPresenter method deleteHistory.

public void deleteHistory(int type) {
    SearchHistoryDao searchHistoryDao = daoSession.getSearchHistoryDao();
    List<SearchHistory> list = searchHistoryDao.queryBuilder().where(SearchHistoryDao.Properties.Type.eq(type)).list();
    if (!ListUtils.isEmpty(list)) {
        for (SearchHistory searchHistory : list) {
            searchHistoryDao.delete(searchHistory);
        }
    }
    showHistory(type);
}
Also used : SearchHistoryDao(cn.nicolite.palm300heroes.db.dao.SearchHistoryDao) SearchHistory(cn.nicolite.palm300heroes.model.bean.SearchHistory)

Aggregations

SearchHistoryDao (cn.nicolite.palm300heroes.db.dao.SearchHistoryDao)4 SearchHistory (cn.nicolite.palm300heroes.model.bean.SearchHistory)3