Package cool.scx.data

Class QueryBuilder

java.lang.Object
cool.scx.data.QueryBuilder

public final class QueryBuilder extends Object
  • Constructor Details

    • QueryBuilder

      public QueryBuilder()
  • Method Details

    • query

      public static Query query()
    • query

      public static Query query(Query oldQuery)
    • where

      public static Where where(Object... whereClauses)
    • groupBy

      public static GroupBy groupBy(Object... groupByClauses)
    • orderBy

      public static OrderBy orderBy(Object... orderByClauses)
    • offset

      public static LimitInfo offset(long limitOffset)
    • limit

      public static LimitInfo limit(long numberOfRows)
    • and

      public static AND and(Object... clauses)
    • or

      public static OR or(Object... clauses)
    • andSet

      public static WhereBodySet andSet()
    • orSet

      public static WhereBodySet orSet()
    • asc

      public static OrderByBody asc(String name, OrderByOption... options)
      正序 : 也就是从小到大 (1,2,3,4,5,6)
      Parameters:
      name - a
      options - 配置
      Returns:
      a
    • desc

      public static OrderByBody desc(String name, OrderByOption... options)
      倒序 : 也就是从大到小 (6,5,4,3,2,1)
      Parameters:
      name - a
      options - 配置
      Returns:
      a
    • orderBySet

      public static OrderByBodySet orderBySet()
    • isNull

      public static WhereBody isNull(String fieldName, WhereOption... options)
      为空
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      options - 配置
      Returns:
      this 方便链式调用
    • isNotNull

      public static WhereBody isNotNull(String fieldName, WhereOption... options)
      不为空
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      options - 配置
      Returns:
      this 方便链式调用
    • eq

      public static WhereBody eq(String fieldName, Object value, WhereOption... options)
      相等
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • ne

      public static WhereBody ne(String fieldName, Object value, WhereOption... options)
      不相等
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • gt

      public static WhereBody gt(String fieldName, Object value, WhereOption... options)
      大于
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • ge

      public static WhereBody ge(String fieldName, Object value, WhereOption... options)
      大于等于
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • lt

      public static WhereBody lt(String fieldName, Object value, WhereOption... options)
      小于
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • le

      public static WhereBody le(String fieldName, Object value, WhereOption... options)
      小于等于
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • between

      public static WhereBody between(String fieldName, Object value1, Object value2, WhereOption... options)
      两者之间
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value1 - 比较值1
      value2 - 比较值2
      options - 配置
      Returns:
      this 方便链式调用
    • notBetween

      public static WhereBody notBetween(String fieldName, Object value1, Object value2, WhereOption... options)
      不处于两者之间
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value1 - 比较值1
      value2 - 比较值2
      options - 配置
      Returns:
      this 方便链式调用
    • likeRegex

      public static WhereBody likeRegex(String fieldName, String value, WhereOption... options)
      like : 根据 SQL 表达式进行判断
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - SQL 表达式
      options - 配置
      Returns:
      this 方便链式调用
    • notLikeRegex

      public static WhereBody notLikeRegex(String fieldName, String value, WhereOption... options)
      not like : 根据 SQL 表达式进行判断
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - SQL 表达式
      options - 配置
      Returns:
      this 方便链式调用
    • like

      public static WhereBody like(String fieldName, Object value, WhereOption... options)
      like : 默认会在首尾添加 %
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 参数 默认会在首尾添加 %
      options - 配置
      Returns:
      this 方便链式调用
    • notLike

      public static WhereBody notLike(String fieldName, Object value, WhereOption... options)
      not like : 默认会在首尾添加 %
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 默认会在首尾添加 %
      options - 配置
      Returns:
      this 方便链式调用
    • jsonContains

      public static WhereBody jsonContains(String fieldName, Object value, WhereOption... options)
      包含 : 一般用于 JSON 格式字段 区别于 in
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • in

      public static WhereBody in(String fieldName, Object value, WhereOption... options)
      在其中
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • notIn

      public static WhereBody notIn(String fieldName, Object value, WhereOption... options)
      不在其中
      Parameters:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      Returns:
      this 方便链式调用
    • whereClause

      public static WhereClause whereClause(String whereClause, Object... params)