类 Where

java.lang.Object
cool.scx.dao.query.Where

public final class Where extends Object
where 查询条件封装类
版本:
0.0.1
作者:
scx567888
  • 构造器详细资料

    • Where

      public Where()
      创建一个 Where 对象
    • Where

      public Where(Where oldWhere)
      根据旧的 Where 创建一个 Where 对象
      参数:
      oldWhere - 旧的 Where
  • 方法详细资料

    • add2

      public Where add2(String name, WhereType whereType, Object value1, Object value2, WhereOption... options)
      添加一个查询条件 (注意 : 此处添加的所有条件都会以 and 拼接 , 如需使用 or 请考虑使用 whereSQL(Object...) })
      参数:
      name - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      whereType - where 类型
      value1 - 参数1
      value2 - 参数2
      options - 配置
      返回:
      本身 , 方便链式调用
    • add1

      public Where add1(String name, WhereType whereType, Object value1, WhereOption... options)
      添加一个查询条件 (注意 : 此处添加的所有条件都会以 and 拼接 , 如需使用 or 请考虑使用 whereSQL(Object...) })
      参数:
      name - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      whereType - where 类型
      value1 - 参数1
      options - 配置
      返回:
      本身 , 方便链式调用
    • add0

      public Where add0(String name, WhereType whereType, WhereOption... options)
      添加一个查询条件 (注意 : 此处添加的所有条件都会以 and 拼接 , 如需使用 or 请考虑使用 whereSQL(Object...) })
      参数:
      name - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      whereType - where 类型
      options - 配置
      返回:
      本身 , 方便链式调用
    • isEmpty

      public boolean isEmpty()
      查询条件是否为空
      返回:
      a boolean
    • isNull

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

      public Where isNotNull(String fieldName, WhereOption... options)
      不为空
      参数:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      options - 配置
      返回:
      this 方便链式调用
    • equal

      public Where equal(String fieldName, Object value, WhereOption... options)
      相等
      参数:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      返回:
      this 方便链式调用
    • notEqual

      public Where notEqual(String fieldName, Object value, WhereOption... options)
      不相等
      参数:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      返回:
      this 方便链式调用
    • greaterThan

      public Where greaterThan(String fieldName, Object value, WhereOption... options)
      大于
      参数:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      返回:
      this 方便链式调用
    • greaterThanOrEqual

      public Where greaterThanOrEqual(String fieldName, Object value, WhereOption... options)
      大于等于
      参数:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      返回:
      this 方便链式调用
    • lessThan

      public Where lessThan(String fieldName, Object value, WhereOption... options)
      小于
      参数:
      fieldName - 名称 (注意 : 默认为字段名称 , 不是数据库名称)
      value - 比较值
      options - 配置
      返回:
      this 方便链式调用
    • lessThanOrEqual

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

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

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

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

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

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

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

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

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

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

      public Object[] whereSQL()

      Getter for the field whereSQL.

      返回:
      a String object
    • whereSQL

      public Where whereSQL(Object... whereSQL)
      设置 whereSQL 适用于 复杂查询的自定义 where 子句
      支持三种类型 String , WhereBody 和 AbstractPlaceholderSQL 在最终 cool.scx.sql 中会拼接到 where 子句的最后
      注意 : 除特殊语法外不需要手动在头部添加 AND
      参数:
      whereSQL - cool.scx.sql 语句
      返回:
      本身 , 方便链式调用
    • remove

      public Where remove(String name)
      a
      参数:
      name - a
      返回:
      a
    • clear

      public Where clear()
      清除所有 where 条件 (不包括 whereSQL)
      返回:
      this 方便链式调用
    • clearWhereSQL

      public Where clearWhereSQL()
      清楚 where 条件中的 whereSQL
      返回:
      this 方便链式调用
    • clearAll

      public Where clearAll()
      清除所有 where 条件 (包括 whereSQL)
      返回:
      this 方便链式调用
    • whereBodyList

      public List<WhereBody> whereBodyList()