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);
}
}
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);
}
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);
}
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);
}
Aggregations