io.ebean.Query.having()方法的使用及代码示例

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

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

Query.having介绍

[英]Add Expressions to the Having clause return the ExpressionList.

Currently only beans based on raw sql will use the having clause.

Note that this returns the ExpressionList (so you can add multiple expressions to the query in a fluent API way).
[中]将表达式添加到Having子句,以返回表达式列表。
目前只有基于原始sql的bean才会使用having子句。
请注意,这将返回ExpressionList(因此您可以以流畅的API方式向查询中添加多个表达式)。

代码示例

代码示例来源:origin: ebean-orm/ebean

  1. @Override
  2. public ExpressionList<T> having() {
  3. return query.having();
  4. }

代码示例来源:origin: org.actframework/act-ebean

  1. @Override
  2. public ExpressionList<MODEL_TYPE> having() {
  3. return q.having();
  4. }

代码示例来源:origin: org.actframework/act-ebean2

  1. @Override
  2. public ExpressionList<MODEL_TYPE> having() {
  3. return q.having();
  4. }

代码示例来源:origin: io.ebean/ebean

  1. @Override
  2. public ExpressionList<T> having() {
  3. return query.having();
  4. }

代码示例来源:origin: org.actframework/act-ebean

  1. @Override
  2. public EbeanQuery<MODEL_TYPE> having(Expression addExpressionToHaving) {
  3. q.having(addExpressionToHaving);
  4. qReadOnly.having(addExpressionToHaving);
  5. return this;
  6. }

代码示例来源:origin: org.actframework/act-ebean2

  1. @Override
  2. public EbeanQuery<MODEL_TYPE> having(Expression addExpressionToHaving) {
  3. q.having(addExpressionToHaving);
  4. return this;
  5. }

代码示例来源:origin: io.ebean/ebean-querybean

  1. /**
  2. * Return the underlying having clause to typically when using dynamic aggregation formula.
  3. * <p>
  4. * Note that after this we no longer have the query bean so typically we use this right
  5. * at the end of the query.
  6. * </p>
  7. *
  8. * <pre>{@code
  9. *
  10. * // sum(distanceKms) ... is a "dynamic formula"
  11. * // so we use havingClause() for it like:
  12. *
  13. * List<MachineUse> machineUse =
  14. *
  15. * new QMachineUse()
  16. * .select("machine, sum(fuelUsed), sum(distanceKms)")
  17. *
  18. * // where ...
  19. * .date.greaterThan(LocalDate.now().minusDays(7))
  20. *
  21. * .havingClause()
  22. * .gt("sum(distanceKms)", 2)
  23. * .findList();
  24. *
  25. * }</pre>
  26. */
  27. public ExpressionList<T> havingClause() {
  28. return query.having();
  29. }

代码示例来源:origin: icode/ameba

  1. /**
  2. * Returns the query's <code>having</code> clause.
  3. *
  4. * @return a {@link io.ebean.ExpressionList} object.
  5. */
  6. public ExpressionList<T> having() {
  7. return query().having();
  8. }

代码示例来源:origin: icode/ameba

  1. /**
  2. * {@inheritDoc}
  3. * Adds an expression to the <code>having</code> clause and returns the query.
  4. */
  5. public Query<T> having(Expression addExpressionToHaving) {
  6. return query().having(addExpressionToHaving);
  7. }

代码示例来源:origin: io.ebean/ebean-querybean

  1. /**
  2. * Start adding expressions to the having clause when using @Aggregation properties.
  3. *
  4. * <pre>{@code
  5. *
  6. * new QMachineUse()
  7. * // where ...
  8. * .date.inRange(fromDate, toDate)
  9. *
  10. * .having()
  11. * .sumHours.greaterThan(1)
  12. * .findList()
  13. *
  14. * // The sumHours property uses @Aggregation
  15. * // e.g. @Aggregation("sum(hours)")
  16. *
  17. * }</pre>
  18. */
  19. public R having() {
  20. if (whereStack == null) {
  21. whereStack = new ArrayStack<>();
  22. }
  23. // effectively putting having expression list onto stack
  24. // such that expression now add to the having clause
  25. whereStack.push(query.having());
  26. return root;
  27. }

代码示例来源:origin: org.actframework/act-ebean

  1. private void syncEbeanQueries() {
  2. _sync("detail");
  3. q.orderBy();
  4. _sync("orderBy");
  5. q.text();
  6. _sync("textExpressions");
  7. q.where();
  8. _sync("whereExpressions");
  9. q.having();
  10. _sync("havingExpressions");
  11. }

代码示例来源:origin: icode/ameba

  1. /** {@inheritDoc} */
  2. @Override
  3. @SuppressWarnings("unchecked")
  4. public void apply(Expression expr) {
  5. if (expr instanceof HavingExpression) {
  6. ExpressionList having = expressionList.query().having();
  7. ((HavingExpression) expr).getExpressionList().forEach(having::add);
  8. return;
  9. } else if (expr instanceof TextExpression) {
  10. TextExpression expression = (TextExpression) expr;
  11. ExpressionList et = expressionList.query().text();
  12. expression.getExpressionList().forEach(et::add);
  13. return;
  14. } else if (expr instanceof DistinctExpression) {
  15. expressionList.setDistinct(((DistinctExpression) expr).distinct);
  16. return;
  17. } else if (expr instanceof AbstractTextExpression) {
  18. expressionList.setUseDocStore(true);
  19. } else if (expr instanceof FilterExpression) {
  20. FilterExpression filter = (FilterExpression) expr;
  21. Query query = expressionList.query();
  22. query.filterMany(filter.getPath()).addAll(filter);
  23. return;
  24. }
  25. expressionList.add(expr);
  26. }
  27. }

代码示例来源:origin: icode/ameba

  1. Object o = args[i].object();
  2. if (o instanceof HavingExpression) {
  3. ExpressionList having = q.having();
  4. ((HavingExpression) o).expressionList.forEach(having::add);
  5. } else if (o instanceof DistinctExpression) {

相关文章

Query类方法