public class Condition extends CloneSupport<Condition>
Modifier and Type | Class and Description |
---|---|
static class |
Condition.LikeType
SQL中 LIKE 语句查询方式
|
Constructor and Description |
---|
Condition()
构造
|
Condition(boolean isPlaceHolder)
构造
|
Condition(String field,
Object value)
构造,使用等于表达式(运算符是=)
|
Condition(String field,
String value,
Condition.LikeType likeType)
构造
|
Condition(String field,
String operator,
Object value)
构造
|
Modifier and Type | Method and Description |
---|---|
Condition |
checkValueNull()
检查值是否为null,如果为null转换为 "IS NULL"形式
|
String |
getField() |
LogicalOperator |
getLinkOperator()
获取与前一个Condition连接的逻辑运算符,可以是and或or
|
String |
getOperator()
获得运算符
大于号,小于号,等于号 等 |
Object |
getSecondValue()
获得between 类型中第二个值
|
Object |
getValue()
获得值
|
boolean |
isOperatorBetween()
是否 between x and y 类型
|
boolean |
isOperatorIn()
是否IN条件
|
boolean |
isOperatorIs()
是否IS条件
|
boolean |
isOperatorLike()
是否LIKE条件
|
boolean |
isPlaceHolder()
是否使用条件占位符
|
static Condition |
parse(String field,
Object expression)
解析为Condition
|
void |
setField(String field)
设置字段名
|
void |
setLinkOperator(LogicalOperator linkOperator)
设置与前一个Condition连接的逻辑运算符,可以是and或or
|
void |
setOperator(String operator)
设置运算符
大于号,小于号,等于号 等 |
void |
setPlaceHolder(boolean isPlaceHolder)
设置是否使用条件占位符
|
void |
setSecondValue(Object secondValue)
设置between 类型中第二个值
|
void |
setValue(Object value)
设置值,不解析表达式
|
void |
setValue(Object value,
boolean isParse)
设置值
|
String |
toString() |
String |
toString(List<Object> paramValues)
转换为条件字符串,并回填占位符对应的参数值
|
clone
public Condition()
public Condition(boolean isPlaceHolder)
isPlaceHolder
- 是否使用条件值占位符public Condition(String field, Object value)
field
- 字段value
- 值public Condition(String field, String operator, Object value)
field
- 字段operator
- 运算符(大于号,小于号,等于号 like 等)value
- 值public Condition(String field, String value, Condition.LikeType likeType)
field
- 字段value
- 值likeType
- Condition.LikeType
public static Condition parse(String field, Object expression)
field
- 字段名expression
- 表达式或普通值public String getField()
public void setField(String field)
field
- 字段名public String getOperator()
public void setOperator(String operator)
operator
- 运算符public Object getValue()
public void setValue(Object value)
value
- 值public void setValue(Object value, boolean isParse)
value
- 值isParse
- 是否解析值表达式public boolean isPlaceHolder()
public void setPlaceHolder(boolean isPlaceHolder)
isPlaceHolder
- 是否使用条件占位符public boolean isOperatorBetween()
public boolean isOperatorIn()
public boolean isOperatorIs()
public boolean isOperatorLike()
public Condition checkValueNull()
public Object getSecondValue()
public void setSecondValue(Object secondValue)
secondValue
- 第二个值public LogicalOperator getLinkOperator()
public void setLinkOperator(LogicalOperator linkOperator)
linkOperator
- 与前一个Condition连接的逻辑运算符,可以是and或orCopyright © 2024. All rights reserved.