接口 Sortable

所有超级接口:
Filterable
所有已知子接口:
FieldFilterArgs<T>, FieldFilterArgsImplementor<T>, FilterArgs<P>, MutableQuery, MutableRootQuery<T>, MutableSubQuery
所有已知实现类:
AbstractMutableQueryImpl, FieldFilterArgsImpl, FilterArgsImpl, MutableRootQueryImpl, MutableSubQueryImpl

public interface Sortable extends Filterable
  • 方法详细资料

    • where

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

      @OldChain @Deprecated default Sortable whereIf(boolean condition, Predicate predicate)
      已过时。
      从接口复制的说明: Filterable
      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

      @OldChain default Sortable 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
      参数:
      condition - The condition
      block - A lambda to create predicate when condition is true
      返回:
      Return the current object to support chain programming style
    • orderBy

      @OldChain Sortable orderBy(Expression<?>... expressions)
    • orderByIf

      @OldChain default Sortable orderByIf(boolean condition, Expression<?>... expressions)
    • orderBy

      @OldChain Sortable orderBy(Order... orders)
    • orderByIf

      @OldChain default Sortable orderByIf(boolean condition, Order... orders)
    • orderBy

      @OldChain Sortable orderBy(List<Order> orders)
    • orderByIf

      @OldChain default Sortable orderByIf(boolean condition, List<Order> orders)