Java Code Examples for com.querydsl.core.types.dsl.BooleanExpression#and()

The following examples show how to use com.querydsl.core.types.dsl.BooleanExpression#and() . 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: AdvertiseController.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * 个人所有广告
 *
 * @param shiroUser
 * @return
 */
@RequestMapping(value = "all")
public MessageResult allNormal(
        PageModel pageModel,
        @SessionAttribute(SESSION_MEMBER) AuthMember shiroUser, HttpServletRequest request) {
    BooleanExpression eq = QAdvertise.advertise.member.id.eq(shiroUser.getId()).
            and(QAdvertise.advertise.status.ne(AdvertiseControlStatus.TURNOFF));;
    if(request.getParameter("status") != null){
        eq.and(QAdvertise.advertise.status.eq(AdvertiseControlStatus.valueOf(request.getParameter("status"))));
    }
    Page<Advertise> all = advertiseService.findAll(eq, pageModel.getPageable());
    return success(all);
}
 
Example 2
Source File: PredicateUtils.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * 将QueryDsl 查询断言List 返回成条件
 *
 * @param booleanExpressions
 * @return
 */
public static Predicate getPredicate(List<BooleanExpression> booleanExpressions) {
    if (booleanExpressions.size() == 0) {
        return null;
    }
    BooleanExpression booleanExpression = null;
    for (int i = 0; i < booleanExpressions.size(); i++) {
        if (i == 0) {
            booleanExpression = booleanExpressions.get(i);
        }
        booleanExpression = booleanExpression.and(booleanExpressions.get(i));
    }
    return booleanExpression;
}
 
Example 3
Source File: AdvertiseController.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * 个人所有广告
 *
 * @param shiroUser
 * @return
 */
@RequestMapping(value = "all")
public MessageResult allNormal(
        PageModel pageModel,
        @SessionAttribute(SESSION_MEMBER) AuthMember shiroUser, HttpServletRequest request) {
    BooleanExpression eq = QAdvertise.advertise.member.id.eq(shiroUser.getId()).
            and(QAdvertise.advertise.status.ne(AdvertiseControlStatus.TURNOFF));;
    if(request.getParameter("status") != null){
        eq.and(QAdvertise.advertise.status.eq(AdvertiseControlStatus.valueOf(request.getParameter("status"))));
    }
    Page<Advertise> all = advertiseService.findAll(eq, pageModel.getPageable());
    return success(all);
}
 
Example 4
Source File: PredicateUtils.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * 将QueryDsl 查询断言List 返回成条件
 *
 * @param booleanExpressions
 * @return
 */
public static Predicate getPredicate(List<BooleanExpression> booleanExpressions) {
    if (booleanExpressions.size() == 0) {
        return null;
    }
    BooleanExpression booleanExpression = null;
    for (int i = 0; i < booleanExpressions.size(); i++) {
        if (i == 0) {
            booleanExpression = booleanExpressions.get(i);
        }
        booleanExpression = booleanExpression.and(booleanExpressions.get(i));
    }
    return booleanExpression;
}
 
Example 5
Source File: OrderFinder.java    From jeeshop with Apache License 2.0 5 votes vote down vote up
private BooleanExpression matchesSearchAndStatusAndItemsSkuId(String searchCriteria, OrderStatus status, Long skuId) {
    BooleanExpression expression = null;

    if (searchCriteria != null)
        expression = matchesSearchCriteria(searchCriteria);

    if (status != null) {
        expression = expression != null ? expression.and(order.status.eq(status)) : order.status.eq(status);
    }

    if (skuId != null) {
        expression = expression != null ? expression.and(order.items.any().skuId.eq(skuId)) : order.items.any().skuId.eq(skuId);
    }
    return expression;
}