本文整理汇总了Java中com.avaje.ebean.ExpressionList.le方法的典型用法代码示例。如果您正苦于以下问题:Java ExpressionList.le方法的具体用法?Java ExpressionList.le怎么用?Java ExpressionList.le使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avaje.ebean.ExpressionList
的用法示例。
在下文中一共展示了ExpressionList.le方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateUserApplicationSummaryQuery
import com.avaje.ebean.ExpressionList; //导入方法依赖的package包/类
/**
* Generates the query for returning the application summaries
* @param usernames The list of usernames
* @param searchParams Any additional parameters
* @param sortKey The key on which the applications should be sorted
* @param increasing The boolean value to sort the output based on the key desc or increasing
* @return The Query object based on the given above parameters
*/
public static Query<AppResult> generateUserApplicationSummaryQuery(List<String> usernames,
Map<String, String> searchParams, String sortKey, boolean increasing) {
ExpressionList<AppResult> query = AppResult.find.select(AppResult.getSearchFields()).where();
Junction<AppResult> junction = query.disjunction();
for (String username : usernames) {
junction.eq(AppResult.TABLE.USERNAME, username);
}
query.endJunction();
String finishedTimeBegin = searchParams.get(Application.FINISHED_TIME_BEGIN);
if (!Utils.isSet(finishedTimeBegin)) {
finishedTimeBegin = String.valueOf(System.currentTimeMillis() - 7 * DAY); // week of data if not specified
}
long time = parseTime(finishedTimeBegin);
if (time > 0) {
query.ge(AppResult.TABLE.FINISH_TIME, time);
}
String finishedTimeEnd = searchParams.get(Application.FINISHED_TIME_END);
if (!Utils.isSet(finishedTimeEnd)) {
finishedTimeEnd = String.valueOf(System.currentTimeMillis());
}
time = parseTime(finishedTimeEnd);
if (time > 0) {
query.le(AppResult.TABLE.FINISH_TIME, time);
}
if (increasing) {
return query.order(getSortKey(sortKey));
} else {
return query.order().desc(getSortKey(sortKey));
}
}