当前位置: 首页>>代码示例>>Java>>正文


Java JPAQuery.orderBy方法代码示例

本文整理汇总了Java中com.mysema.query.jpa.impl.JPAQuery.orderBy方法的典型用法代码示例。如果您正苦于以下问题:Java JPAQuery.orderBy方法的具体用法?Java JPAQuery.orderBy怎么用?Java JPAQuery.orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mysema.query.jpa.impl.JPAQuery的用法示例。


在下文中一共展示了JPAQuery.orderBy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyQueryAndFiltersAndSorting

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
protected void applyQueryAndFiltersAndSorting(ComputerToCurrentUserDesktopSessionGridSearchState searchState) {
    QComputer $record = searchState.$record;
    ComputerToCurrentUserDesktopSessionGridSearchParam searchParam = searchState.searchParam;
    JPAQuery jpaQuery = searchState.jpaQuery;
    // Applying filter
    ComputerToCurrentUserDesktopSessionGridSearchFilter filter = searchParam.filter;
    if (StringUtils.isNotEmpty(filter.name)) {
        jpaQuery.where($record.name.containsIgnoreCase(filter.name));
    }
    // Applying action filters
    // Applying sorting
    Sorting sorting = searchParam.sorting;
    ComparableExpressionBase sortingExpression = null;
    if (sorting != null) {
        if ("name".equals(sorting.ref)) {
            sortingExpression = $record.name;
        }
    }
    if (sortingExpression != null) {
        jpaQuery.orderBy(SortingType.ASCENDING.equals(sorting.type) ? sortingExpression.asc() : sortingExpression.desc());
    }
    applyPaginationSort(searchState);
}
 
开发者ID:iorga-group,项目名称:ivif,代码行数:24,代码来源:ComputerBaseService.java

示例2: applyQueryAndFiltersAndSorting

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
protected void applyQueryAndFiltersAndSorting(SpecificSearchUserGridSearchState searchState) {
    QUser $record = searchState.$record;
    SpecificSearchUserGridSearchParam searchParam = searchState.searchParam;
    JPAQuery jpaQuery = searchState.jpaQuery;
    // Applying filter
    SpecificSearchUserGridSearchFilter filter = searchParam.filter;
    if (StringUtils.isNotEmpty(filter.name)) {
        jpaQuery.where($record.name.containsIgnoreCase(filter.name));
    }
    if (StringUtils.isNotEmpty(filter.firstName)) {
        jpaQuery.where($record.firstName.containsIgnoreCase(filter.firstName));
    }
    // Applying action filters
    // Applying sorting
    Sorting sorting = searchParam.sorting;
    ComparableExpressionBase sortingExpression = null;
    if (sorting != null) {
        if ("name".equals(sorting.ref)) {
            sortingExpression = $record.name;
        }
    }
    if (sortingExpression != null) {
        jpaQuery.orderBy(SortingType.ASCENDING.equals(sorting.type) ? sortingExpression.asc() : sortingExpression.desc());
    }
    applyPaginationSort(searchState);
}
 
开发者ID:iorga-group,项目名称:ivif,代码行数:27,代码来源:UserBaseService.java

示例3: iterator

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public Iterator<? extends AbstractTask> iterator(long first, long count) {
    QAbstractTask task = QAbstractTask.abstractTask;
    QWork work = task.as(QWork.class);

    JPAQuery query = new JPAQuery(page.getEntityManager());
    query.from(QAbstractTask.abstractTask).leftJoin(work.part.project);
    query.where(createPredicate());
    query.orderBy(task.date.asc());

    query.offset(first);
    query.limit(count);

    List<AbstractTask> found = query.list(task);
    if (found != null) {
        return found.iterator();
    }

    return new ArrayList<AbstractTask>().iterator();
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:21,代码来源:AbstractTaskDataProvider.java

示例4: listProjectsFromDb

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
private static List<CustomerProjectPartDto> listProjectsFromDb(EntityManager entityManager) {
    QCustomer customer = QCustomer.customer;
    QProject project = QProject.project;
    QPart part = QPart.part;

    JPAQuery query = new JPAQuery(entityManager);
    query.from(customer).leftJoin(customer.projects, project).leftJoin(QProject.project.parts, part);
    query.where(QProject.project.closed.eq(false).and(part.id.isNotNull()));
    query.orderBy(customer.name.asc(), project.name.asc(), part.name.asc());

    Map<String, Expression<?>> bindings = new HashMap<>();
    bindings.put(CustomerProjectPartDto.F_CUSTOMER_ID, customer.id);
    bindings.put(CustomerProjectPartDto.F_CUSTOMER_NAME, customer.name);
    bindings.put(CustomerProjectPartDto.F_PROJECT_ID, project.id);
    bindings.put(CustomerProjectPartDto.F_PROJECT_NAME, project.name);
    bindings.put(CustomerProjectPartDto.F_PART_ID, part.id);
    bindings.put(CustomerProjectPartDto.F_PART_NAME, part.name);
    QBean projection = new QBean(CustomerProjectPartDto.class, true, bindings);

    return query.list(projection);
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:22,代码来源:GizmoUtils.java

示例5: loadData

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public static List<AbstractTask> loadData(WorkFilterDto filter, EntityManager entityManager) {
    List<AbstractTask> data = new ArrayList<>();
    if (filter == null) {
        return data;
    }

    List<Predicate> predicates = AbstractTaskDataProvider.createPredicates(filter);

    QAbstractTask task = QAbstractTask.abstractTask;
    QWork work = task.as(QWork.class);

    JPAQuery query = new JPAQuery(entityManager);
    query.from(task).leftJoin(work.part.project);
    if (!predicates.isEmpty()) {
        BooleanBuilder where = new BooleanBuilder();
        where.orAllOf(predicates.toArray(new Predicate[predicates.size()]));
        query.where(where);
    }
    query.orderBy(task.date.asc());

    return query.list(task);
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:23,代码来源:GizmoUtils.java

示例6: parse

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public JPAQuery parse(String expression, QueryDslContext context, ParserConfig config) {
    QueryDslEvaluator evaluator = new QueryDslEvaluator();
    evaluator.evaluate(expression, context, config);

    JPAQuery query = new JPAQuery(em)
            .from(context.getEntityPath());

    if (context.getPredicate() != null) {
        query.where(context.getPredicate());
    }

    if (context.getQueryModifiers() != null) {
        query.restrict(context.getQueryModifiers());
    }

    if (context.getOrderSpecifiers() != null && !context.getOrderSpecifiers().isEmpty()) {
        query.orderBy(context.getOrderSpecifiers().toArray(new OrderSpecifier[0]));
    }

    return query;
}
 
开发者ID:edmocosta,项目名称:queryfy,代码行数:22,代码来源:JPAQueryDslParser.java

示例7: applyPaging

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
private <T, R> void applyPaging(JoinerQuery<T, R> request, JPAQuery query) {
    if (request.getLimit() != null) {
        query.limit(request.getLimit());
    }
    if (request.getOffset() != null) {
        query.offset(request.getOffset());
    }

    for (QueryOrder queryOrder : request.getOrder()) {
        // TODO apply predicate resolver as well
        query.orderBy(transformOrder(queryOrder));
    }
}
 
开发者ID:encircled,项目名称:Joiner,代码行数:14,代码来源:Joiner.java

示例8: applyQueryAndFiltersAndSorting

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
protected void applyQueryAndFiltersAndSorting(ProfileGridSearchState searchState) {
    QProfile $record = searchState.$record;
    ProfileGridSearchParam searchParam = searchState.searchParam;
    JPAQuery jpaQuery = searchState.jpaQuery;
    // Applying filter
    ProfileGridSearchFilter filter = searchParam.filter;
    if (StringUtils.isNotEmpty(filter.name)) {
        jpaQuery.where($record.name.containsIgnoreCase(filter.name));
    }
    // Applying action filters
    if (filter.openProfileGridFromUser != null) {
        // Check additionnal rights for that action
        securityService.check("admin");
        OpenProfileGridFromUser parameters = filter.openProfileGridFromUser;
        jpaQuery.where($record.id.eq(parameters.profileId));
    }
    // Applying sorting
    Sorting sorting = searchParam.sorting;
    ComparableExpressionBase sortingExpression = null;
    if (sorting != null) {
        if ("name".equals(sorting.ref)) {
            sortingExpression = $record.name;
        }
    }
    if (sortingExpression != null) {
        jpaQuery.orderBy(SortingType.ASCENDING.equals(sorting.type) ? sortingExpression.asc() : sortingExpression.desc());
    }
    applyPaginationSort(searchState);
}
 
开发者ID:iorga-group,项目名称:ivif,代码行数:30,代码来源:ProfileBaseService.java

示例9: getPaginatedResult

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public Page<Tuple> getPaginatedResult(QueryParameters parameters, JPAQuery jpaQuery, Expression<?>... args) {
	Optional<OrderSpecifier> orderSpecifier = getOrderSpecifier(parameters, args);
	if (orderSpecifier.isPresent()) {
		jpaQuery.orderBy(orderSpecifier.get());
	}
	List<Tuple> result = jpaQuery.offset(parameters.getDisplayStart()).limit(parameters.getSize()).list(args);
	return new PageImpl<>(result, pageableFactory.getPageable(parameters), jpaQuery.count());
}
 
开发者ID:fernaspiazu,项目名称:recruiting-old-style,代码行数:10,代码来源:PaginationServiceImpl.java


注:本文中的com.mysema.query.jpa.impl.JPAQuery.orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。