com.querydsl.core.types.dsl.BooleanExpression Java Examples
The following examples show how to use
com.querydsl.core.types.dsl.BooleanExpression.
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: OrderService.java From ZTuoExchange_framework with MIT License | 7 votes |
public Page<OtcOrderVO> outExcel(List<Predicate> predicates , PageModel pageModel){ List<OrderSpecifier> orderSpecifiers = pageModel.getOrderSpecifiers(); JPAQuery<OtcOrderVO> query = queryFactory.select( Projections.fields(OtcOrderVO.class, QOrder.order.id.as("id"), QOrder.order.orderSn.as("orderSn"), QOrder.order.advertiseType.as("advertiseType"), QOrder.order.createTime.as("createTime"), QOrder.order.memberName.as("memberName"), QOrder.order.customerName.as("customerName"), QOrder.order.coin.unit, QOrder.order.money, QOrder.order.number, QOrder.order.commission.as("fee"), QOrder.order.payMode.as("payMode"), QOrder.order.releaseTime.as("releaseTime"), QOrder.order.cancelTime.as("cancelTime"), QOrder.order.payTime.as("payTime"), QOrder.order.status.as("status")) ).from(QOrder.order).where(predicates.toArray(new BooleanExpression[predicates.size()])); query.orderBy(orderSpecifiers.toArray(new OrderSpecifier[orderSpecifiers.size()])); List<OtcOrderVO> list = query.offset((pageModel.getPageNo()-1)*pageModel.getPageSize()).limit(pageModel.getPageSize()).fetch(); long total = query.fetchCount() ; return new PageImpl<>(list,pageModel.getPageable(),total); }
Example #2
Source File: AdminAdvertiseController.java From ZTuoExchange_framework with MIT License | 6 votes |
private List<BooleanExpression> getBooleanExpressionList( Date startTime, Date endTime, AdvertiseType advertiseType, String realName) { QAdvertise qEntity = QAdvertise.advertise; List<BooleanExpression> booleanExpressionList = new ArrayList(); booleanExpressionList.add(qEntity.status.in(AdvertiseControlStatus.PUT_ON_SHELVES, AdvertiseControlStatus.PUT_OFF_SHELVES)); if (startTime != null) { booleanExpressionList.add(qEntity.createTime.gt(startTime)); } if (endTime != null) { booleanExpressionList.add(qEntity.createTime.lt(endTime)); } if (advertiseType != null) { booleanExpressionList.add(qEntity.advertiseType.eq(advertiseType)); } if (org.apache.commons.lang3.StringUtils.isNotBlank(realName)) { booleanExpressionList.add(qEntity.member.realName.like("%" + realName + "%")); } return booleanExpressionList; }
Example #3
Source File: MemberController.java From ZTuoExchange_framework with MIT License | 6 votes |
private Predicate getPredicate(MemberScreen screen) { ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>(); if (screen.getStatus() != null) { booleanExpressions.add(member.certifiedBusinessStatus.eq(screen.getStatus())); } if (screen.getStartTime() != null) { booleanExpressions.add(member.registrationTime.goe(screen.getStartTime())); } if (screen.getEndTime() != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(screen.getEndTime()); calendar.add(Calendar.DAY_OF_YEAR, 1); booleanExpressions.add(member.registrationTime.lt(calendar.getTime())); } if (!StringUtils.isEmpty(screen.getAccount())) { booleanExpressions.add(member.username.like("%" + screen.getAccount() + "%") .or(member.mobilePhone.like(screen.getAccount() + "%")) .or(member.email.like(screen.getAccount() + "%")) .or(member.realName.like("%" + screen.getAccount() + "%"))); } if (screen.getCommonStatus() != null) { booleanExpressions.add(member.status.eq(screen.getCommonStatus())); } return PredicateUtils.getPredicate(booleanExpressions); }
Example #4
Source File: TransferAddressController.java From ZTuoExchange_framework with MIT License | 6 votes |
@RequiresPermissions("system:transfer-address:page-query") @PostMapping("page-query") public MessageResult pageQuery(PageModel pageModel, TransferAddressScreen transferAddressScreen){ List<BooleanExpression> booleanExpressions = new ArrayList<>(); if(StringUtils.isNotBlank(transferAddressScreen.getAddress())) { booleanExpressions.add(QTransferAddress.transferAddress.address.eq(transferAddressScreen.getAddress())); } if(StringUtils.isNotBlank(transferAddressScreen.getUnit())) { booleanExpressions.add(QTransferAddress.transferAddress.coin.unit.equalsIgnoreCase(transferAddressScreen.getAddress())); } if(transferAddressScreen.getStart()!=null) { booleanExpressions.add(QTransferAddress.transferAddress.status.eq(transferAddressScreen.getStart())); } Page<TransferAddress> page = transferAddressService.findAll(PredicateUtils.getPredicate(booleanExpressions),pageModel); return MessageResult.getSuccessInstance("获取成功",page); }
Example #5
Source File: MemberApplicationController.java From ZTuoExchange_framework with MIT License | 6 votes |
@RequiresPermissions("member:member-application:page-query") @PostMapping("page-query") @AccessLog(module = AdminModule.MEMBER, operation = "分页查找会员MemberApplication认证信息") public MessageResult queryPage(PageModel pageModel, MemberApplicationScreen screen) { List<BooleanExpression> booleanExpressions = new ArrayList<>(); if (screen.getAuditStatus() != null) { booleanExpressions.add(memberApplication.auditStatus.eq(screen.getAuditStatus())); } if (!StringUtils.isEmpty(screen.getAccount())) { booleanExpressions.add(memberApplication.member.username.like("%" + screen.getAccount() + "%") //.or(memberApplication.member.mobilePhone.like(screen.getAccount() + "%")) // .or(memberApplication.member.email.like(screen.getAccount() + "%")) .or(memberApplication.member.realName.like("%" + screen.getAccount() + "%"))); } if(!StringUtils.isEmpty(screen.getCardNo())) { booleanExpressions.add(memberApplication.member.idNumber.like("%" + screen.getCardNo() + "%")); } Predicate predicate = PredicateUtils.getPredicate(booleanExpressions); Page<MemberApplication> all = memberApplicationService.findAll(predicate, pageModel.getPageable()); return success(all); }
Example #6
Source File: ExchangeOrderService.java From ZTuoExchange_framework with MIT License | 6 votes |
@Transactional(readOnly = true) public PageResult<ExchangeOrder> queryWhereOrPage(List<Predicate> predicates, Integer pageNo, Integer pageSize) { List<ExchangeOrder> list; JPAQuery<ExchangeOrder> jpaQuery = queryFactory.selectFrom(QExchangeOrder.exchangeOrder); if (predicates != null) { jpaQuery.where(predicates.toArray(new BooleanExpression[predicates.size()])); } jpaQuery.orderBy(QExchangeOrder.exchangeOrder.time.desc()); if (pageNo != null && pageSize != null) { list = jpaQuery.offset((pageNo - 1) * pageSize).limit(pageSize).fetch(); } else { list = jpaQuery.fetch(); } PageResult<ExchangeOrder> result = new PageResult<>(list, jpaQuery.fetchCount()); result.setNumber(pageNo); result.setSize(pageSize); return result; }
Example #7
Source File: AdminAdvertiseController.java From ZTuoExchange_framework with MIT License | 6 votes |
private Predicate getPredicate(AdvertiseScreen screen) { ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>(); if(screen.getStatus()!=AdvertiseControlStatus.TURNOFF&&screen.getStatus()!=null) { booleanExpressions.add(QAdvertise.advertise.status.eq(screen.getStatus())); } if (screen.getStatus() == null){ booleanExpressions.add(QAdvertise.advertise.status.eq(AdvertiseControlStatus.PUT_ON_SHELVES).or(QAdvertise.advertise.status.eq(AdvertiseControlStatus.PUT_OFF_SHELVES))); } if (screen.getAdvertiseType() != null) { booleanExpressions.add(QAdvertise.advertise.advertiseType.eq(screen.getAdvertiseType())); } if (StringUtils.isNotBlank(screen.getAccount())) { booleanExpressions.add(QAdvertise.advertise.member.realName.like("%" + screen.getAccount() + "%") .or(QAdvertise.advertise.member.username.like("%" + screen.getAccount() + "%")) .or(QAdvertise.advertise.member.mobilePhone.like((screen.getAccount()+"%"))) .or(QAdvertise.advertise.member.email.like((screen.getAccount()+"%")))); } if(screen.getPayModel()!=null) { booleanExpressions.add(QAdvertise.advertise.payMode.contains(screen.getPayModel())); } return PredicateUtils.getPredicate(booleanExpressions); }
Example #8
Source File: RewardPromotionController.java From ZTuoExchange_framework with MIT License | 6 votes |
/** * 查询所有未被禁用的(判断type条件) * 默认按照updatetime降序 * * @param enable * @param type * @return */ @RequiresPermissions("promotion:reward:page-query") @GetMapping("page-query") @AccessLog(module = AdminModule.SYSTEM, operation = "分页查询邀请奖励设置") public MessageResult pageQuery( PageModel pageModel, @RequestParam(value = "status", defaultValue = "1") BooleanEnum enable, @RequestParam(value = "type", required = false) PromotionRewardType type) { BooleanExpression predicate = null; if (type != null) { predicate.andAnyOf(QRewardPromotionSetting.rewardPromotionSetting.type.eq(type)); } Page<RewardPromotionSetting> all = rewardPromotionSettingService.findAll(predicate, pageModel); for(RewardPromotionSetting setting : all){ if(StringUtils.isEmpty(setting.getInfo())) { continue ; } JSONObject jsonObject = JSONObject.parseObject(setting.getInfo()); setting.setOne(jsonObject.getBigDecimal("one")); setting.setTwo(jsonObject.getBigDecimal("two")); } return success(all); }
Example #9
Source File: MemberController.java From ZTuoExchange_framework with MIT License | 6 votes |
private List<BooleanExpression> getBooleanExpressionList( Date startTime, Date endTime, String account, CertifiedBusinessStatus status) { List<BooleanExpression> booleanExpressionList = new ArrayList(); if (status != null) { booleanExpressionList.add(member.certifiedBusinessStatus.eq(status)); } if (startTime != null) { booleanExpressionList.add(member.registrationTime.gt(startTime)); } if (endTime != null) { booleanExpressionList.add(member.registrationTime.lt(endTime)); } if (org.apache.commons.lang3.StringUtils.isNotBlank(account)) { booleanExpressionList.add(member.username.like("%" + account + "%") .or(member.mobilePhone.like(account + "%")) .or(member.email.like(account + "%"))); } return booleanExpressionList; }
Example #10
Source File: MemberController.java From ZTuoExchange_framework with MIT License | 6 votes |
private List<BooleanExpression> getBooleanExpressionList( Date startTime, Date endTime, String account, CertifiedBusinessStatus status) { List<BooleanExpression> booleanExpressionList = new ArrayList(); if (status != null) { booleanExpressionList.add(member.certifiedBusinessStatus.eq(status)); } if (startTime != null) { booleanExpressionList.add(member.registrationTime.gt(startTime)); } if (endTime != null) { booleanExpressionList.add(member.registrationTime.lt(endTime)); } if (org.apache.commons.lang3.StringUtils.isNotBlank(account)) { booleanExpressionList.add(member.username.like("%" + account + "%") .or(member.mobilePhone.like(account + "%")) .or(member.email.like(account + "%"))); } return booleanExpressionList; }
Example #11
Source File: TransferAddressController.java From ZTuoExchange_framework with MIT License | 6 votes |
@RequiresPermissions("system:transfer-address:page-query") @PostMapping("page-query") public MessageResult pageQuery(PageModel pageModel, TransferAddressScreen transferAddressScreen){ List<BooleanExpression> booleanExpressions = new ArrayList<>(); if(StringUtils.isNotBlank(transferAddressScreen.getAddress())) { booleanExpressions.add(QTransferAddress.transferAddress.address.eq(transferAddressScreen.getAddress())); } if(StringUtils.isNotBlank(transferAddressScreen.getUnit())) { booleanExpressions.add(QTransferAddress.transferAddress.coin.unit.equalsIgnoreCase(transferAddressScreen.getAddress())); } if(transferAddressScreen.getStart()!=null) { booleanExpressions.add(QTransferAddress.transferAddress.status.eq(transferAddressScreen.getStart())); } Page<TransferAddress> page = transferAddressService.findAll(PredicateUtils.getPredicate(booleanExpressions),pageModel); return MessageResult.getSuccessInstance("获取成功",page); }
Example #12
Source File: MemberController.java From ZTuoExchange_framework with MIT License | 6 votes |
private Predicate getPredicate(MemberScreen screen) { ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>(); if (screen.getStatus() != null) { booleanExpressions.add(member.certifiedBusinessStatus.eq(screen.getStatus())); } if (screen.getStartTime() != null) { booleanExpressions.add(member.registrationTime.goe(screen.getStartTime())); } if (screen.getEndTime() != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(screen.getEndTime()); calendar.add(Calendar.DAY_OF_YEAR, 1); booleanExpressions.add(member.registrationTime.lt(calendar.getTime())); } if (!StringUtils.isEmpty(screen.getAccount())) { booleanExpressions.add(member.username.like("%" + screen.getAccount() + "%") .or(member.mobilePhone.like(screen.getAccount() + "%")) .or(member.email.like(screen.getAccount() + "%")) .or(member.realName.like("%" + screen.getAccount() + "%"))); } if (screen.getCommonStatus() != null) { booleanExpressions.add(member.status.eq(screen.getCommonStatus())); } return PredicateUtils.getPredicate(booleanExpressions); }
Example #13
Source File: MemberApplicationController.java From ZTuoExchange_framework with MIT License | 6 votes |
@RequiresPermissions("member:member-application:page-query") @PostMapping("page-query") @AccessLog(module = AdminModule.MEMBER, operation = "分页查找会员MemberApplication认证信息") public MessageResult queryPage(PageModel pageModel, MemberApplicationScreen screen) { List<BooleanExpression> booleanExpressions = new ArrayList<>(); if (screen.getAuditStatus() != null) { booleanExpressions.add(memberApplication.auditStatus.eq(screen.getAuditStatus())); } if (!StringUtils.isEmpty(screen.getAccount())) { booleanExpressions.add(memberApplication.member.username.like("%" + screen.getAccount() + "%") //.or(memberApplication.member.mobilePhone.like(screen.getAccount() + "%")) // .or(memberApplication.member.email.like(screen.getAccount() + "%")) .or(memberApplication.member.realName.like("%" + screen.getAccount() + "%"))); } if(!StringUtils.isEmpty(screen.getCardNo())) { booleanExpressions.add(memberApplication.member.idNumber.like("%" + screen.getCardNo() + "%")); } Predicate predicate = PredicateUtils.getPredicate(booleanExpressions); Page<MemberApplication> all = memberApplicationService.findAll(predicate, pageModel.getPageable()); return success(all); }
Example #14
Source File: ExchangeOrderService.java From ZTuoExchange_framework with MIT License | 6 votes |
@Transactional(readOnly = true) public PageResult<ExchangeOrder> queryWhereOrPage(List<Predicate> predicates, Integer pageNo, Integer pageSize) { List<ExchangeOrder> list; JPAQuery<ExchangeOrder> jpaQuery = queryFactory.selectFrom(QExchangeOrder.exchangeOrder); if (predicates != null) { jpaQuery.where(predicates.toArray(new BooleanExpression[predicates.size()])); } jpaQuery.orderBy(QExchangeOrder.exchangeOrder.time.desc()); if (pageNo != null && pageSize != null) { list = jpaQuery.offset((pageNo - 1) * pageSize).limit(pageSize).fetch(); } else { list = jpaQuery.fetch(); } PageResult<ExchangeOrder> result = new PageResult<>(list, jpaQuery.fetchCount()); result.setNumber(pageNo); result.setSize(pageSize); return result; }
Example #15
Source File: AdminAdvertiseController.java From ZTuoExchange_framework with MIT License | 6 votes |
private Predicate getPredicate(AdvertiseScreen screen) { ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>(); if(screen.getStatus()!=AdvertiseControlStatus.TURNOFF&&screen.getStatus()!=null) { booleanExpressions.add(QAdvertise.advertise.status.eq(screen.getStatus())); } if (screen.getStatus() == null){ booleanExpressions.add(QAdvertise.advertise.status.eq(AdvertiseControlStatus.PUT_ON_SHELVES).or(QAdvertise.advertise.status.eq(AdvertiseControlStatus.PUT_OFF_SHELVES))); } if (screen.getAdvertiseType() != null) { booleanExpressions.add(QAdvertise.advertise.advertiseType.eq(screen.getAdvertiseType())); } if (StringUtils.isNotBlank(screen.getAccount())) { booleanExpressions.add(QAdvertise.advertise.member.realName.like("%" + screen.getAccount() + "%") .or(QAdvertise.advertise.member.username.like("%" + screen.getAccount() + "%")) .or(QAdvertise.advertise.member.mobilePhone.like((screen.getAccount()+"%"))) .or(QAdvertise.advertise.member.email.like((screen.getAccount()+"%")))); } if(screen.getPayModel()!=null) { booleanExpressions.add(QAdvertise.advertise.payMode.contains(screen.getPayModel())); } return PredicateUtils.getPredicate(booleanExpressions); }
Example #16
Source File: AdminAdvertiseController.java From ZTuoExchange_framework with MIT License | 6 votes |
private List<BooleanExpression> getBooleanExpressionList( Date startTime, Date endTime, AdvertiseType advertiseType, String realName) { QAdvertise qEntity = QAdvertise.advertise; List<BooleanExpression> booleanExpressionList = new ArrayList(); booleanExpressionList.add(qEntity.status.in(AdvertiseControlStatus.PUT_ON_SHELVES, AdvertiseControlStatus.PUT_OFF_SHELVES)); if (startTime != null) { booleanExpressionList.add(qEntity.createTime.gt(startTime)); } if (endTime != null) { booleanExpressionList.add(qEntity.createTime.lt(endTime)); } if (advertiseType != null) { booleanExpressionList.add(qEntity.advertiseType.eq(advertiseType)); } if (org.apache.commons.lang3.StringUtils.isNotBlank(realName)) { booleanExpressionList.add(qEntity.member.realName.like("%" + realName + "%")); } return booleanExpressionList; }
Example #17
Source File: MemberTransactionService.java From ZTuoExchange_framework with MIT License | 6 votes |
public List findAllByWhere(Date startTime, Date endTime, TransactionType type, Long memberId) { QMemberTransaction qMemberTransaction = QMemberTransaction.memberTransaction; List<BooleanExpression> booleanExpressionList = new ArrayList(); if (startTime != null) { booleanExpressionList.add(qMemberTransaction.createTime.gt(startTime)); } if (endTime != null) { booleanExpressionList.add(qMemberTransaction.createTime.lt(endTime)); } if (type != null) { booleanExpressionList.add(qMemberTransaction.type.eq(type)); } if (memberId != null) { booleanExpressionList.add(qMemberTransaction.memberId.eq(memberId)); } return queryFactory.selectFrom(qMemberTransaction). where(booleanExpressionList.toArray(booleanExpressionList.toArray(new BooleanExpression[booleanExpressionList.size()]))) .fetch(); }
Example #18
Source File: MemberTransactionController.java From ZTuoExchange_framework with MIT License | 6 votes |
private List<BooleanExpression> getBooleanExpressionList( Date startTime, Date endTime, TransactionType type, Long memberId) { QMemberTransaction qEntity = QMemberTransaction.memberTransaction; List<BooleanExpression> booleanExpressionList = new ArrayList(); if (startTime != null) { booleanExpressionList.add(qEntity.createTime.gt(startTime)); } if (endTime != null) { booleanExpressionList.add(qEntity.createTime.lt(endTime)); } if (type != null) { booleanExpressionList.add(qEntity.type.eq(type)); } if (memberId != null) { booleanExpressionList.add(qEntity.memberId.eq(memberId)); } return booleanExpressionList; }
Example #19
Source File: RewardPromotionController.java From ZTuoExchange_framework with MIT License | 6 votes |
/** * 查询所有未被禁用的(判断type条件) * 默认按照updatetime降序 * * @param enable * @param type * @return */ @RequiresPermissions("promotion:reward:page-query") @GetMapping("page-query") @AccessLog(module = AdminModule.SYSTEM, operation = "分页查询邀请奖励设置") public MessageResult pageQuery( PageModel pageModel, @RequestParam(value = "status", defaultValue = "1") BooleanEnum enable, @RequestParam(value = "type", required = false) PromotionRewardType type) { BooleanExpression predicate = null; if (type != null) { predicate.andAnyOf(QRewardPromotionSetting.rewardPromotionSetting.type.eq(type)); } Page<RewardPromotionSetting> all = rewardPromotionSettingService.findAll(predicate, pageModel); for(RewardPromotionSetting setting : all){ if(StringUtils.isEmpty(setting.getInfo())) { continue ; } JSONObject jsonObject = JSONObject.parseObject(setting.getInfo()); setting.setOne(jsonObject.getBigDecimal("one")); setting.setTwo(jsonObject.getBigDecimal("two")); } return success(all); }
Example #20
Source File: AdminAccessLogService.java From ZTuoExchange_framework with MIT License | 6 votes |
public Page<AdminAccessLog> page(List<BooleanExpression> predicates, PageModel pageModel){ JPAQuery<AdminAccessLog> query = queryFactory.select( Projections.fields(AdminAccessLog.class, QAdminAccessLog.adminAccessLog.id.as("id"), QAdminAccessLog.adminAccessLog.accessIp.as("accessIp"), QAdminAccessLog.adminAccessLog.accessMethod.as("accessMethod"), QAdminAccessLog.adminAccessLog.accessTime.as("accessTime"), QAdminAccessLog.adminAccessLog.adminId.as("adminId"), QAdminAccessLog.adminAccessLog.uri.as("uri"), QAdminAccessLog.adminAccessLog.module.as("module"), QAdminAccessLog.adminAccessLog.operation.as("operation"), QAdmin.admin.username.as("adminName")) ).from(QAdminAccessLog.adminAccessLog,QAdmin.admin).where(predicates.toArray(new BooleanExpression[predicates.size()])) ; List<OrderSpecifier> orderSpecifiers = pageModel.getOrderSpecifiers() ; query.orderBy(orderSpecifiers.toArray(new OrderSpecifier[orderSpecifiers.size()])); long total = query.fetchCount() ; query.offset(pageModel.getPageSize()*(pageModel.getPageNo()-1)).limit(pageModel.getPageSize()); List<AdminAccessLog> list = query.fetch() ; return new PageImpl<AdminAccessLog>(list,pageModel.getPageable(),total); }
Example #21
Source File: RewardRecordService.java From ZTuoExchange_framework with MIT License | 6 votes |
public Page<RewardRecord> queryRewardPromotionPage(int pageNo, int pageSize, Member member) { Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "id")); Pageable pageable = new PageRequest(pageNo - 1, pageSize, sort); ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>(); Specification specification = new Specification<RewardRecord>() { List<Predicate> predicates = new ArrayList<>(); @Override public Predicate toPredicate(Root<RewardRecord> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) { predicates.add(criteriaBuilder.equal(root.get("member"), member)); predicates.add(criteriaBuilder.equal(root.get("type"), 0)); return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()])); } }; return rewardRecordDao.findAll(specification,pageable); }
Example #22
Source File: ScreenAbility.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 获取条件(添加外部筛选) * * @param booleanExpressions 条件断言 * @return */ default Predicate getPredicate(BooleanExpression... booleanExpressions) { ArrayList<BooleanExpression> booleanExpressionsList = getBooleanExpressions(); for (BooleanExpression b : booleanExpressions) { booleanExpressionsList.add(b); } return PredicateUtils.getPredicate(booleanExpressionsList); }
Example #23
Source File: SysHelpService.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 条件查询对象 pageNo pageSize 同时传时分页 * * @param booleanExpressionList * @param pageNo * @param pageSize * @return */ @Transactional(readOnly = true) public PageResult<SysHelp> queryWhereOrPage(List<BooleanExpression> booleanExpressionList, Integer pageNo, Integer pageSize) { JPAQuery<SysHelp> jpaQuery = queryFactory.selectFrom(QSysHelp.sysHelp); if (booleanExpressionList != null) { jpaQuery.where(booleanExpressionList.toArray(new BooleanExpression[booleanExpressionList.size()])); } jpaQuery.orderBy(QSysHelp.sysHelp.createTime.desc()); List<SysHelp> list = jpaQuery.offset((pageNo - 1) * pageSize).limit(pageSize).fetch(); long count = jpaQuery.fetchCount(); PageResult<SysHelp> page = new PageResult<>(list, pageNo, pageSize, count); return page; }
Example #24
Source File: PredicateUtils.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 将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 #25
Source File: MemberService.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 条件查询对象 pageNo pageSize 同时传时分页 * * @param booleanExpressionList * @param pageNo * @param pageSize * @return */ @Transactional(readOnly = true) public PageResult<Member> queryWhereOrPage(List<BooleanExpression> booleanExpressionList, Integer pageNo, Integer pageSize) { List<Member> list; JPAQuery<Member> jpaQuery = queryFactory.selectFrom(QMember.member) .where(booleanExpressionList.toArray(new BooleanExpression[booleanExpressionList.size()])); jpaQuery.orderBy(QMember.member.id.desc()); if (pageNo != null && pageSize != null) { list = jpaQuery.offset((pageNo - 1) * pageSize).limit(pageSize).fetch(); } else { list = jpaQuery.fetch(); } return new PageResult<>(list, jpaQuery.fetchCount()); }
Example #26
Source File: WithdrawRecordService.java From ZTuoExchange_framework with MIT License | 5 votes |
public Page<WithdrawRecordVO> joinFind(List<Predicate> predicates, PageModel pageModel) { List<OrderSpecifier> orderSpecifiers = pageModel.getOrderSpecifiers(); JPAQuery<WithdrawRecordVO> query = queryFactory.select( Projections.fields(WithdrawRecordVO.class, QWithdrawRecord.withdrawRecord.id.as("id"), QWithdrawRecord.withdrawRecord.memberId.as("memberId"), QWithdrawRecord.withdrawRecord.coin.unit, QMember.member.username.as("memberUsername"), QMember.member.realName.as("memberRealName"), QMember.member.mobilePhone.as("phone"), QMember.member.email, QWithdrawRecord.withdrawRecord.dealTime.as("dealTime"), QWithdrawRecord.withdrawRecord.totalAmount.as("totalAmount"), QWithdrawRecord.withdrawRecord.arrivedAmount.as("arrivedAmount"), QWithdrawRecord.withdrawRecord.status, QWithdrawRecord.withdrawRecord.isAuto.as("isAuto"), QWithdrawRecord.withdrawRecord.address, QWithdrawRecord.withdrawRecord.createTime.as("createTime"), QWithdrawRecord.withdrawRecord.fee, QWithdrawRecord.withdrawRecord.transactionNumber.as("transactionNumber"), QWithdrawRecord.withdrawRecord.remark) ).from(QWithdrawRecord.withdrawRecord, QMember.member).where(predicates.toArray(new BooleanExpression[predicates.size()])); query.orderBy(orderSpecifiers.toArray(new OrderSpecifier[orderSpecifiers.size()])); List<WithdrawRecordVO> list = query.offset((pageModel.getPageNo() - 1) * pageModel.getPageSize()).limit(pageModel.getPageSize()).fetch(); long total = query.fetchCount(); return new PageImpl<>(list, pageModel.getPageable(), total); }
Example #27
Source File: OrderFinder.java From jeeshop with Apache License 2.0 | 5 votes |
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; }
Example #28
Source File: AdvertiseScreen.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 处理内部断言 * * @return */ @Override public ArrayList<BooleanExpression> getBooleanExpressions() { ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>(); if (status != null) { booleanExpressions.add(QAdvertise.advertise.status.eq(status)); } return booleanExpressions; }
Example #29
Source File: AdvertiseController.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 个人所有广告 * * @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 #30
Source File: MemberTransactionController.java From ZTuoExchange_framework with MIT License | 5 votes |
@RequiresPermissions("finance:member-transaction:out-excel") @GetMapping("out-excel") @AccessLog(module = AdminModule.FINANCE, operation = "导出交易记录MemberTransaction Excel") public MessageResult outExcel( @RequestParam(value = "startTime", required = false) Date startTime, @RequestParam(value = "endTime", required = false) Date endTime, @RequestParam(value = "type", required = false) TransactionType type, @RequestParam(value = "memberId", required = false) Long memberId, HttpServletRequest request, HttpServletResponse response) throws Exception { List<BooleanExpression> booleanExpressionList = getBooleanExpressionList(startTime, endTime, type, memberId); List list = memberTransactionService.queryWhereOrPage(booleanExpressionList, null, null).getContent(); return new FileUtil().exportExcel(request, response, list, "交易记录"); }