类 AbstractMutableQueryImpl

java.lang.Object
org.babyfish.jimmer.sql.ast.impl.AbstractMutableStatementImpl
org.babyfish.jimmer.sql.ast.impl.query.AbstractMutableQueryImpl
所有已实现的接口:
FilterableImplementor, MutableStatementImplementor, Filterable, MutableQuery, Sortable, SubQueryProvider
直接已知子类:
MutableRootQueryImpl, MutableSubQueryImpl

public abstract class AbstractMutableQueryImpl extends AbstractMutableStatementImpl implements MutableQuery
  • 字段详细资料

    • ORDER_BY_PRIORITY_STATEMENT

      public static final int ORDER_BY_PRIORITY_STATEMENT
      另请参阅:
    • ORDER_BY_PRIORITY_GLOBAL_FILTER

      public static final int ORDER_BY_PRIORITY_GLOBAL_FILTER
      另请参阅:
    • ORDER_BY_PRIORITY_PROP_FILTER

      public static final int ORDER_BY_PRIORITY_PROP_FILTER
      另请参阅:
  • 构造器详细资料

    • AbstractMutableQueryImpl

      protected AbstractMutableQueryImpl(JSqlClientImplementor sqlClient, org.babyfish.jimmer.meta.ImmutableType immutableType)
    • AbstractMutableQueryImpl

      protected AbstractMutableQueryImpl(JSqlClientImplementor sqlClient, TableProxy<?> table)
  • 方法详细资料

    • where

      public AbstractMutableQueryImpl where(Predicate... predicates)
      从接口复制的说明: Filterable
      Add some predicates(logical and)
      指定者:
      where 在接口中 Filterable
      指定者:
      where 在接口中 Sortable
      覆盖:
      where 在类中 AbstractMutableStatementImpl
      参数:
      predicates - Predicates, everything one can be null
      返回:
      Return the current object to support chain programming style
    • whereIf

      @OldChain @Deprecated public AbstractMutableQueryImpl whereIf(boolean condition, Predicate predicate)
      已过时。
      This method is deprecated, using Dynamic Predicates is a more convenient approach.

      Please look at this example:

      
       whereIf(name != null, table.name().eq(name))
       
      When name is null, this code works because eq(null) is automatically translated by Jimmer to isNull(), which doesn't cause an exception.

      Let's look at another example:

      
       whereIf(minPrice != null, table.price().ge(minPrice))
       
      Except RUST marco, almost all programming languages calculate all parameters first and then call the function. Therefore, before whereIf is executed, ge(null) already causes an exception.

      For this reason, whereIf provides an overloaded form with a lambda parameter:

      
       whereIf(minPrice != null, () -> table.price().ge(minPrice))
       
      Although this overloaded form can solve this problem, it ultimately adds a mental burden during development.

      Therefore, Jimmer provides Dynamic Predicates

      • Java: eqIf, neIf, ltIf, leIf, gtIf, geIf, likeIf, ilikeIf, betweenIf
      • Kotlin: eq?, ne?, lt?, le?, gt?, ge?, like?, ilike?, betweenIf?
      Taking Java's geIf as an example, this functionality is ultimately implemented like this.
      
       where(table.price().geIf(minPrice))
       
      指定者:
      whereIf 在接口中 Filterable
      指定者:
      whereIf 在接口中 Sortable
    • whereIf

      @OldChain public AbstractMutableQueryImpl whereIf(boolean condition, Supplier<Predicate> block)
      从接口复制的说明: Filterable
      Avoid using this method whenever possible, using Dynamic Predicates are a more convenient approach.

      Please look at this example:

      
       whereIf(name != null, table.name().eq(name))
       
      When name is null, this code works because eq(null) is automatically translated by Jimmer to isNull(), which doesn't cause an exception.

      Let's look at another example:

      
       whereIf(minPrice != null, table.price().ge(minPrice))
       
      Except RUST marco, almost all programming languages calculate all parameters first and then call the function. Therefore, before whereIf is executed, ge(null) already causes an exception.

      For this reason, whereIf provides an overloaded form with a lambda parameter:

      
       whereIf(minPrice != null, () -> table.price().ge(minPrice))
       
      Although this overloaded form can solve this problem, it ultimately adds a mental burden during development.

      Therefore, Jimmer provides Dynamic Predicate

      • Java: eqIf, neIf, ltIf, leIf, gtIf, geIf, likeIf, ilikeIf, betweenIf
      • Kotlin: eq?, ne?, lt?, le?, gt?, ge?, like?, ilike?, betweenIf?
      Taking Java's geIf as an example, this functionality is ultimately implemented like this.
      
       where(table.price().geIf(minPrice))
       
      指定者:
      whereIf 在接口中 Filterable
      指定者:
      whereIf 在接口中 Sortable
      参数:
      condition - The condition
      block - A lambda to create predicate when condition is true
      返回:
      Return the current object to support chain programming style
    • groupBy

      public AbstractMutableQueryImpl groupBy(Expression<?>... expressions)
      指定者:
      groupBy 在接口中 MutableQuery
    • having

      public AbstractMutableQueryImpl having(Predicate... predicates)
      指定者:
      having 在接口中 MutableQuery
    • orderBy

      public AbstractMutableQueryImpl orderBy(Expression<?>... expressions)
      指定者:
      orderBy 在接口中 MutableQuery
      指定者:
      orderBy 在接口中 Sortable
    • orderByIf

      public AbstractMutableQueryImpl orderByIf(boolean condition, Expression<?>... expressions)
      指定者:
      orderByIf 在接口中 MutableQuery
      指定者:
      orderByIf 在接口中 Sortable
    • orderBy

      public AbstractMutableQueryImpl orderBy(Order... orders)
      指定者:
      orderBy 在接口中 MutableQuery
      指定者:
      orderBy 在接口中 Sortable
    • orderByIf

      public AbstractMutableQueryImpl orderByIf(boolean condition, Order... orders)
      指定者:
      orderByIf 在接口中 MutableQuery
      指定者:
      orderByIf 在接口中 Sortable
    • orderBy

      @OldChain public AbstractMutableQueryImpl orderBy(List<Order> orders)
      指定者:
      orderBy 在接口中 MutableQuery
      指定者:
      orderBy 在接口中 Sortable
    • orderByIf

      @OldChain public AbstractMutableQueryImpl orderByIf(boolean condition, List<Order> orders)
      指定者:
      orderByIf 在接口中 MutableQuery
      指定者:
      orderByIf 在接口中 Sortable
    • getHavingPredicate

      public Predicate getHavingPredicate(AstContext astContext)
    • onFrozen

      protected void onFrozen(AstContext astContext)
      覆盖:
      onFrozen 在类中 AbstractMutableStatementImpl
    • isGroupByClauseUsed

      protected boolean isGroupByClauseUsed()
    • getGroupExpressions

      protected List<Expression<?>> getGroupExpressions()
      覆盖:
      getGroupExpressions 在类中 AbstractMutableStatementImpl
    • getHavingPredicates

      public List<Predicate> getHavingPredicates()
      覆盖:
      getHavingPredicates 在类中 AbstractMutableStatementImpl
    • setHavingPredicates

      public void setHavingPredicates(List<Predicate> havingPredicates)
      覆盖:
      setHavingPredicates 在类中 AbstractMutableStatementImpl
    • getOrders

      public List<Order> getOrders()
      覆盖:
      getOrders 在类中 AbstractMutableStatementImpl
    • getAcceptedOrderByPriority

      public int getAcceptedOrderByPriority()
    • setOrderByPriority

      public void setOrderByPriority(int priority)