本文整理了Java中org.springframework.data.mongodb.core.query.Criteria.lt()
方法的一些代码示例,展示了Criteria.lt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Criteria.lt()
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Criteria
类名称:Criteria
方法名:lt
[英]Creates a criterion using the $lt operator.
[中]使用$lt运算符创建条件。
代码示例来源:origin: yu199195/hmily
@Override
public List<HmilyTransaction> listAllByDelay(final Date date) {
Query query = new Query();
query.addCriteria(Criteria.where("lastTime").lt(date));
final List<MongoAdapter> mongoBeans =
template.find(query, MongoAdapter.class, collectionName);
if (CollectionUtils.isNotEmpty(mongoBeans)) {
return mongoBeans.stream().map(this::buildByCache).collect(Collectors.toList());
}
return Collections.emptyList();
}
代码示例来源:origin: spring-projects/spring-data-mongodb
case BEFORE:
case LESS_THAN:
return criteria.lt(parameters.next());
case LESS_THAN_EQUAL:
return criteria.lte(parameters.next());
case BETWEEN:
return criteria.gt(parameters.next()).lt(parameters.next());
case IS_NOT_NULL:
return criteria.ne(null);
代码示例来源:origin: yu199195/myth
@Override
public List<MythTransaction> listAllByDelay(final Date date) {
Query query = new Query();
query.addCriteria(Criteria.where("lastTime").lt(date))
.addCriteria(Criteria.where("status").is(MythStatusEnum.BEGIN.getCode()));
final List<MongoAdapter> mongoBeans = template.find(query, MongoAdapter.class, collectionName);
if (CollectionUtils.isNotEmpty(mongoBeans)) {
return mongoBeans.stream().map(this::buildByCache).collect(Collectors.toList());
}
return Collections.emptyList();
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
case BEFORE:
case LESS_THAN:
return criteria.lt(parameters.next());
case LESS_THAN_EQUAL:
return criteria.lte(parameters.next());
case BETWEEN:
return criteria.gt(parameters.next()).lt(parameters.next());
case IS_NOT_NULL:
return criteria.ne(null);
代码示例来源:origin: yu199195/Raincat
@Override
public List<TransactionRecover> listAllByDelay(final Date date) {
Query query = new Query();
query.addCriteria(new Criteria("status")
.in(TransactionStatusEnum.BEGIN.getCode(),
TransactionStatusEnum.FAILURE.getCode(),
TransactionStatusEnum.ROLLBACK.getCode()))
.addCriteria(Criteria.where("lastTime").lt(date));
final List<MongoAdapter> mongoBeans =
template.find(query, MongoAdapter.class, collectionName);
if (CollectionUtils.isNotEmpty(mongoBeans)) {
return mongoBeans.stream().map(this::buildByCache).collect(Collectors.toList());
}
return null;
}
代码示例来源:origin: yu199195/hmily
baseQuery.addCriteria(new Criteria("retriedCount").lt(query.getRetry()));
代码示例来源:origin: yu199195/Raincat
baseQuery.addCriteria(new Criteria("retriedCount").lt(query.getRetry()));
代码示例来源:origin: timebusker/spring-boot
@Override
public List<PersonEntity> findByParams(Map params) {
Query query = new Query();
Iterator<String> iterator = params.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
query.addCriteria(Criteria.where(key).lt(params.get(key)));
}
List<PersonEntity> list = mongoTemplate.find(query, PersonEntity.class);
return list;
}
代码示例来源:origin: timebusker/spring-boot
@Override
public List<PersonEntity> findWithPageByParams(Map params) {
Query query = new Query();
MongoDBPageable pageable = new MongoDBPageable(2);
Iterator<String> iterator = params.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
query.addCriteria(Criteria.where(key).lt(params.get(key)));
}
Long allcount = mongoTemplate.count(query, PersonEntity.class);
List<PersonEntity> list = mongoTemplate.find(query.with(pageable), PersonEntity.class);
Page<PersonEntity> page = new PageImpl<PersonEntity>(list, pageable, allcount);
return page.getContent();
}
}
代码示例来源:origin: pl.edu.icm.polindex/polindex-core
private Criteria solutionDateBeforeCriterion(Date solutionDate) {
return Criteria.where(PROPERTY_COANSYS_SOLUTION_DATE).lt(solutionDate);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl
@Override
public void cleanExpiredNotifications() {
DateTime time = new DateTime();
DateTime cleanTime = time.minusDays(timeToRemoveNotificationInDays);
Date cleanDate = new Date(cleanTime.getMillis());
Query query = new Query(Criteria.where(QUERY_PARAM_CREATION_TIMESTAMP).lt(cleanDate));
mongoTemplate.remove(query, mongoCollectionName);
}
代码示例来源:origin: com.epam.reportportal/commons-dao
/**
* Query for entities modified later than provided date
*
* @param date
* @return
*/
public static Query findModifiedLaterThan(final Date date) {
return Query.query(Criteria.where(Modifiable.LAST_MODIFIED).lt(date));
}
代码示例来源:origin: sentilo/sentilo
@Override
@Scheduled(initialDelay = 30000, fixedRate = 3600000)
public void deleteOldActivityLogs() {
// Only stores the activity from the last 7 days
final long tsToCompare = System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000;
final Criteria criteria = Criteria.where("timestamp").lt(tsToCompare);
doDelete(new Query(criteria));
}
代码示例来源:origin: sentilo/sentilo
@Scheduled(initialDelay = 30000, fixedRate = 600000)
public void deleteOldPerformanceLogs() {
// Only stores the performance from the last day
final long tsToCompare = System.currentTimeMillis() - 24 * 60 * 60 * 1000;
final Criteria criteria = Criteria.where("timestamp").lt(tsToCompare);
doDelete(new Query(criteria));
}
代码示例来源:origin: com.epam.reportportal/commons-dao
/**
* Finds files with provided project and uploaded later than provided time period
*
* @param period
* @param project
* @return
*/
public static Query findModifiedLaterThanPeriod(final Duration period, final String project) {
Query query = Query.query(Criteria.where(Modifiable.UPLOADED).lt(Date.from(Instant.now().minusSeconds(period.getSeconds()))));
return query.addCriteria(Criteria.where(METADATA).is(project));
}
代码示例来源:origin: com.epam.reportportal/commons-dao
@Override
public void expireBidsOlderThan(Date lastLogin) {
mongoOperations.remove(Query.query(Criteria.where(Modifiable.LAST_MODIFIED).lt(lastLogin)), UserCreationBid.class);
}
代码示例来源:origin: pl.edu.icm.polindex/polindex-core
private Criteria precedingByModificationDateAndIdCriterion(Date date, String id) {
Criteria criteria = new Criteria()
.orOperator(
Criteria.where(PROPERTY_MODIFICATION_DATE).lt(date),
new Criteria().andOperator(
Criteria.where(PROPERTY_MODIFICATION_DATE).is(date),
Criteria.where(F_ID).lt(id)
)
);
return criteria;
}
代码示例来源:origin: com.epam.reportportal/commons-dao
@Override
public void expireUsersLoggedOlderThan(Date lastLogin) {
mongoOperations.updateMulti(query(where(MetaInfo.LAST_LOGIN_PATH).lt(lastLogin)), update(IS_EXPIRED, true), User.class);
}
代码示例来源:origin: com.epam.reportportal/commons-dao
@Override
public Page<User> findByTypeAndLastSynchronizedBefore(UserType type, Date lastSynchronized, Pageable pageable) {
Query q = query(where("type").is(type).and(MetaInfo.SYNCHRONIZATION_DATE).lt(lastSynchronized)).with(pageable);
long count = mongoOperations.count(q, User.class);
return new PageImpl<>(mongoOperations.find(q, User.class), pageable, count);
}
代码示例来源:origin: com.epam.reportportal/commons-dao
@Override
public void addCondition(Criteria criteria, FilterCondition filter, CriteriaHolder criteriaHolder) {
/* Validate only numbers & dates */
this.validate(criteriaHolder, filter.getValue(), filter.isNegative(), INCORRECT_FILTER_PARAMETERS);
Object valueToFind = ObjectId.isValid(filter.getValue()) ?
new ObjectId(filter.getValue()) :
this.castValue(criteriaHolder, filter.getValue(), INCORRECT_FILTER_PARAMETERS);
criteria.lt(valueToFind);
}
内容来源于网络,如有侵权,请联系作者删除!