本文整理匯總了Java中de.greenrobot.dao.query.QueryBuilder.orderDesc方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryBuilder.orderDesc方法的具體用法?Java QueryBuilder.orderDesc怎麽用?Java QueryBuilder.orderDesc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類de.greenrobot.dao.query.QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.orderDesc方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMessagesForThreadForEntityID
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
/**
* Get all messages for given thread id ordered Ascending/Descending
*/
public List<BMessage> getMessagesForThreadForEntityID(Long id, int limit) {
List<BMessage> list ;
QueryBuilder<BMessage> qb = DaoCore.daoSession.queryBuilder(BMessage.class);
qb.where(BMessageDao.Properties.ThreadDaoId.eq(id));
// Making sure no null messages infected the sort.
qb.where(BMessageDao.Properties.Date.isNotNull());
qb.where(BMessageDao.Properties.Sender.isNotNull());
qb.orderDesc(BMessageDao.Properties.Date);
if (limit != -1)
qb.limit(limit);
list = qb.list();
return list;
}
示例2: queryUnFinished
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
/**
* @description: 查詢未完成的軌跡
* @author: chenshiqiang E-mail:[email protected]
* @return
*/
public Track queryUnFinished(){
QueryBuilder<Track> qb = dao.queryBuilder();
qb.where(Properties.RecordStatus.notEq(RecordStatus.finished.getValue()));
qb.orderDesc(Properties.BeginTime);
List<Track> ls = qb.list();
if(ls != null && !ls.isEmpty()){
if(ls.size() == 1){
return ls.get(0);
}else{
Track uf = ls.remove(0);
//停止最近以前的所有軌跡
List<Long> cs = new ArrayList<Long>();
for(Track t : ls){
cs.add(t.getId());
}
stopTracks(cs);
return uf;
}
}
return null;
}
示例3: getDBLuaFileByVersion
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
private String getDBLuaFileByVersion(String s)
{
LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
int j = (int)luazipfiledao.count();
Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
if (j > 0)
{
QueryBuilder querybuilder = luazipfiledao.queryBuilder();
Property aproperty[] = new Property[1];
aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
querybuilder.orderDesc(aproperty);
querybuilder.where(de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version.eq(s), new WhereCondition[0]);
LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
String s1 = luazipfile.getVersion();
Debug.i("chenee", (new StringBuilder()).append("luaZipFile.version:").append(s1).toString());
return unzip(luazipfile.getZipFile());
} else
{
Debug.e("chenee", (new StringBuilder()).append("read DB zip failed,version:").append(s).toString());
return null;
}
}
示例4: fetchEntitiesWithPropertiesAndOrder
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public static <T extends Entity> List<T> fetchEntitiesWithPropertiesAndOrder(Class<T> c, Property whereOrder, int order, Property properties[], Object... values){
if (values == null || properties == null)
throw new NullPointerException("You must have at least one value and one property");
if (values.length != properties.length)
throw new IllegalArgumentException("Values size should match properties size");
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(properties[0].eq(values[0]));
for (int i = 0 ; i < values.length ; i++)
qb.where(properties[i].eq(values[i]));
if (whereOrder != null && order != -1)
switch (order)
{
case ORDER_ASC:
qb.orderAsc(whereOrder);
break;
case ORDER_DESC:
qb.orderDesc(whereOrder);
break;
}
return qb.list();
}
示例5: fetchEntitiesWithPropertiesAndOrderAndLimit
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public static <T extends Entity> List<T> fetchEntitiesWithPropertiesAndOrderAndLimit(Class<T> c, int limit, Property whereOrder, int order, Property properties[], Object... values){
if (values == null || properties == null)
throw new NullPointerException("You must have at least one value and one property");
if (values.length != properties.length)
throw new IllegalArgumentException("Values size should match properties size");
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(properties[0].eq(values[0]));
if (values.length > 1)
for (int i = 0 ; i < values.length ; i++)
qb.where(properties[i].eq(values[i]));
if (whereOrder != null && order != -1)
switch (order)
{
case ORDER_ASC:
qb.orderAsc(whereOrder);
break;
case ORDER_DESC:
qb.orderDesc(whereOrder);
break;
}
if (limit != -1)
qb.limit(limit);
return qb.listLazy();
}
示例6: getList
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
setIfLog();
QueryBuilder queryBuilder = dao.queryBuilder();
if (isAsc) {
queryBuilder = queryBuilder.orderAsc(orderProperty);
} else {
queryBuilder = queryBuilder.orderDesc(orderProperty);
}
List indexFavList = queryBuilder.list();
return indexFavList;
}
示例7: queryAllDailyMealsOrdered
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
/**
* Returns a list of {@link DailyMeal} ordered by date
*/
public List<DailyMeal> queryAllDailyMealsOrdered(boolean order) {
QueryBuilder<DailyMeal> queryBuilder = mDao.getDailyMealDao().queryBuilder();
if (order) {
queryBuilder.orderDesc(DailyMealDao.Properties.EatenOn);
}
return queryBuilder.list();
}
示例8: queryLastItem
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
public LuaList queryLastItem(QueryBuilder querybuilder)
{
Property aproperty[] = new Property[1];
aproperty[0] = de.greenrobot.daobracelet.LuaListDao.Properties.Id;
querybuilder.orderDesc(aproperty);
List list = querybuilder.list();
if (list.size() > 0)
{
return (LuaList)list.get(0);
} else
{
return null;
}
}
示例9: getLatestDBLuaFile
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
private String getLatestDBLuaFile()
{
LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
int j = (int)luazipfiledao.count();
Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
if (j > 0)
{
QueryBuilder querybuilder = luazipfiledao.queryBuilder();
Property aproperty[] = new Property[1];
aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
querybuilder.orderDesc(aproperty);
LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
String s = luazipfile.getVersion();
String s1 = getDefaultLuaFileVersion();
if (s.compareTo(s1) <= 0)
{
Debug.e("chenee", (new StringBuilder()).append("version compare failed: version:").append(s).append(" default version is:").append(s1).toString());
return null;
} else
{
Debug.i("chenee", (new StringBuilder()).append("use latest script, version:").append(s).append(" (default version is:").append(s1).append(")").toString());
return unzip(luazipfile.getZipFile());
}
} else
{
Debug.e("chenee", "read DB zip file failed");
return null;
}
}
示例10: getList
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
/**
* Executes the query and returns the result as a list containing all entities loaded into memory.
* @param dao
* @param isAsc
* @param orderProperty
* @return
*/
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
setIfLog();
QueryBuilder queryBuilder = dao.queryBuilder();
if (isAsc) {
queryBuilder = queryBuilder.orderAsc(orderProperty);
} else {
queryBuilder = queryBuilder.orderDesc(orderProperty);
}
List indexFavList = queryBuilder.list();
return indexFavList;
}
示例11: queryAllDescByBeginTimeFromDb
import de.greenrobot.dao.query.QueryBuilder; //導入方法依賴的package包/類
/**
* @description: 從數據庫查詢所有軌跡,按照開始時間降序
* @author: chenshiqiang E-mail:[email protected]
* @return
*/
private List<Track> queryAllDescByBeginTimeFromDb(){
QueryBuilder<Track> qb = dao.queryBuilder();
qb.orderDesc(Properties.BeginTime);
return qb.list();
}