Java Code Examples for com.querydsl.jpa.impl.JPAQuery#offset()

The following examples show how to use com.querydsl.jpa.impl.JPAQuery#offset() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderFinder.java    From jeeshop with Apache License 2.0 6 votes vote down vote up
public List<Order> findByUser(User user, Integer offset, Integer limit, String orderby, Boolean isDesc, OrderStatus status) {
    JPAQuery<Order> query = new JPAQueryFactory(entityManager).selectFrom(order)
            .where(
                    order.user.eq(user),
                    status != null && status.equals(OrderStatus.CREATED) ? null : order.status.ne(OrderStatus.CREATED),
                    status != null ? order.status.eq(status) : null);

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderby, isDesc, query);

    return query.fetch();
}
 
Example 2
Source File: CatalogItemFinder.java    From jeeshop with Apache License 2.0 5 votes vote down vote up
private void addOffsetAndLimitToQuery(Integer offset, Integer limit, JPAQuery query, String orderBy, Boolean isDesc, QCatalogItem qCatalogItem) {
    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderBy, isDesc, query, qCatalogItem);
}
 
Example 3
Source File: UserFinder.java    From jeeshop with Apache License 2.0 5 votes vote down vote up
public List<User> findBySearchCriteria(String searchCriteria, Integer offset, Integer limit, String orderBy, Boolean isDesc) {
    JPAQuery<User> query = new JPAQueryFactory(entityManager).selectFrom(user)
            .where(buildSearchPredicate(searchCriteria));

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderBy, isDesc, query);

    return query.fetch();
}
 
Example 4
Source File: OrderFinder.java    From jeeshop with Apache License 2.0 4 votes vote down vote up
public List<Order> findAll(Integer offset, Integer limit, String orderby, Boolean isDesc, String searchCriteria, OrderStatus status, Long skuId, boolean enhanceResult) {
    JPAQuery<Order> query = new JPAQueryFactory(entityManager).selectFrom(order)
            .where(matchesSearchAndStatusAndItemsSkuId(searchCriteria, status, skuId));

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderby, isDesc, query);

    List<Order> orders = query.fetch();

    if (enhanceResult)
        orders.forEach(this::enhanceOrder);

    return orders;

}
 
Example 5
Source File: UserFinder.java    From jeeshop with Apache License 2.0 3 votes vote down vote up
public List<User> findAll(Integer offset, Integer limit, String orderBy, Boolean isDesc) {
    JPAQuery<User> query = new JPAQueryFactory(entityManager).selectFrom(user);

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderBy, isDesc, query);

    return query.fetch();

}
 
Example 6
Source File: MailTemplateFinder.java    From jeeshop with Apache License 2.0 3 votes vote down vote up
public List<MailTemplate> findAll(Integer offset, Integer limit, String orderBy, Boolean isDesc) {
    JPAQuery<MailTemplate> query = new JPAQueryFactory(entityManager).selectFrom(mailTemplate);

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderBy, isDesc, query);

    return query.fetch();

}