org.springframework.data.jpa.repository.support.Querydsl.applySorting()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.springframework.data.jpa.repository.support.Querydsl.applySorting方法的一些代码示例,展示了Querydsl.applySorting的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Querydsl.applySorting方法的具体详情如下:
包路径:org.springframework.data.jpa.repository.support.Querydsl
类名称:Querydsl
方法名:applySorting

Querydsl.applySorting介绍

[英]Applies sorting to the given JPQLQuery.
[中]将排序应用于给定的JPQLQuery。

代码示例

代码示例来源:origin: spring-projects/spring-data-jpa

/**
   * Executes the given {@link JPQLQuery} after applying the given {@link Sort}.
   *
   * @param query must not be {@literal null}.
   * @param sort must not be {@literal null}.
   * @return
   */
  private List<T> executeSorted(JPQLQuery<T> query, Sort sort) {
    return querydsl.applySorting(sort, query).fetch();
  }
}

代码示例来源:origin: spring-projects/spring-data-jpa

/**
   * Executes the given {@link JPQLQuery} after applying the given {@link Sort}.
   *
   * @param query must not be {@literal null}.
   * @param sort must not be {@literal null}.
   * @return
   */
  private List<T> executeSorted(JPQLQuery<T> query, Sort sort) {
    return querydsl.applySorting(sort, query).fetch();
  }
}

代码示例来源:origin: spring-projects/spring-data-jpa

/**
 * Applies the given {@link Pageable} to the given {@link JPQLQuery}.
 *
 * @param pageable
 * @param query must not be {@literal null}.
 * @return the Querydsl {@link JPQLQuery}.
 */
public <T> JPQLQuery<T> applyPagination(Pageable pageable, JPQLQuery<T> query) {
  if (pageable.isUnpaged()) {
    return query;
  }
  query.offset(pageable.getOffset());
  query.limit(pageable.getPageSize());
  return applySorting(pageable.getSort(), query);
}

代码示例来源:origin: org.springframework.data/spring-data-jpa

/**
   * Executes the given {@link JPQLQuery} after applying the given {@link Sort}.
   *
   * @param query must not be {@literal null}.
   * @param sort must not be {@literal null}.
   * @return
   */
  private List<T> executeSorted(JPQLQuery<T> query, Sort sort) {
    return querydsl.applySorting(sort, query).fetch();
  }
}

代码示例来源:origin: org.springframework.data/spring-data-jpa

/**
   * Executes the given {@link JPQLQuery} after applying the given {@link Sort}.
   *
   * @param query must not be {@literal null}.
   * @param sort must not be {@literal null}.
   * @return
   */
  private List<T> executeSorted(JPQLQuery<T> query, Sort sort) {
    return querydsl.applySorting(sort, query).fetch();
  }
}

代码示例来源:origin: com.airlenet/play-repo-jpa

@Deprecated
protected void onCreateSort(JPQLQuery<?> query) {
  Class<T> domainClass = getDomainClass();
  if (ClassUtils.isAssignable(DataEntity.class, domainClass)) {
    Sort createdDateDesc = new Sort(Direction.DESC, "createdDate");
    query = querydsl.applySorting(createdDateDesc, query);
  }
  if (ClassUtils.isAssignable(SortEntity.class, domainClass)) {
    Sort sortNoAsc = new Sort("sortNo");
    query = querydsl.applySorting(sortNoAsc, query);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-jpa

/**
 * Applies the given {@link Pageable} to the given {@link JPQLQuery}.
 *
 * @param pageable
 * @param query must not be {@literal null}.
 * @return the Querydsl {@link JPQLQuery}.
 */
public <T> JPQLQuery<T> applyPagination(Pageable pageable, JPQLQuery<T> query) {
  if (pageable.isUnpaged()) {
    return query;
  }
  query.offset(pageable.getOffset());
  query.limit(pageable.getPageSize());
  return applySorting(pageable.getSort(), query);
}

相关文章