public interface Condition extends ConditionAssistant
| Modifier and Type | Method and Description |
|---|---|
Condition |
and()
Default will automatically add 'and'.
|
Condition |
between(String field,
Number low,
Number high)
transform to: field between low and high;
|
Condition |
between(String field,
String low,
String high)
field between 'low' and 'high';
|
Condition |
forUpdate()
lock the select record with 'for update'.
|
Condition |
groupBy(String field)
group by
|
Condition |
having(FunctionType functionType,
String field,
Op op,
Number value)
having
eg: having(FunctionType.MIN, "field", Op.ge, 60)-->having min(field)>=60 |
Condition |
lParentheses()
Add left parentheses.
|
Condition |
notBetween(String field,
Number low,
Number high)
not between
|
Condition |
notBetween(String field,
String low,
String high)
not between
|
Condition |
op(String field,
Op op,
Object value)
Add a expression condition.
|
Condition |
opOn(String field,
Op op,
Number value)
The expression will correspond to: table1 JoinType table2 on field Op value
eg: opOn("table2.valid",Op.eq,1) table1 left join table2 on table1.id=table2.id and table2.valid=1 it is different from where part: table1 left join table2 on table1.id=table2.id where valid=1 |
Condition |
opOn(String field,
Op op,
String value)
The expression will correspond to: table1 JoinType table2 on field Op value
eg: opOn("table2.valid",Op.eq,"1") table1 left join table2 on table1.id=table2.id and table2.valid='1' it is different from where part: table1 left join table2 on table1.id=table2.id where valid='1' |
Condition |
opWithField(String field1,
Op op,
String field2)
Add a expression condition.
|
Condition |
or()
Add 'or'.
|
Condition |
orderBy(FunctionType functionType,
String field,
OrderType orderType)
order by
eg: orderBy(FunctionType.MAX, "total", OrderType.DESC)-->order by max(total) desc |
Condition |
orderBy(String field)
order by
eg: orderBy("price")-->order by price |
Condition |
orderBy(String field,
OrderType orderType)
order by
eg: orderBy("price", OrderType.DESC)-->order by price desc |
Condition |
rParentheses()
Add right parentheses.
|
Condition |
selectDistinctField(String fieldName)
set fieldName for distinct(fieldName)
eg: selectDistinctField(fieldName) --> distinct(fieldName) |
Condition |
selectDistinctField(String fieldName,
String alias)
set fieldName for distinct(fieldName)
eg: selectDistinctField(fieldName,alias) --> distinct(fieldName) as alias
|
Condition |
selectField(String... fieldList)
Specify the partial fields to be queried (only for select of SQL).
|
Condition |
selectFun(FunctionType functionType,
String fieldForFun)
set for select result with function.
|
Condition |
selectFun(FunctionType functionType,
String fieldForFun,
String alias)
set for select result with function.
|
Condition |
set(String fieldName,
Number num)
Set the fields that need to be updated (only for update of SQL );
this method can be used when the set fields also need to be used for the where expression. |
Condition |
set(String fieldName,
String value)
Set the fields that need to be updated (only for update of SQL);
this method can be used when the set fields also need to be used for the where expression. |
Condition |
setAdd(String field,
Number num)
Set the fields to be updated (for only update of SQL),and the field change on itself.
|
Condition |
setAdd(String field,
String otherFieldName)
Set the fields to be updated (for only update of SQL),and the field change on itself.
|
Condition |
setIncludeType(IncludeType includeType)
Set the IncludeType filter parameter.
|
Condition |
setMultiply(String field,
Number num)
Set the fields to be updated (for only update of SQL),and the field change on itself.
|
Condition |
setMultiply(String field,
String otherFieldName)
Set the fields to be updated (for only update of SQL),and the field change on itself.
|
Condition |
setWithField(String field1,
String field2)
set one field with other field value
eg: setWithField(field1,field2)--> set field1=field2 |
Condition |
size(Integer size)
For setting the size of the page(only for select of SQL).
|
Condition |
start(Integer start)
For setting the start of the page(only for select of SQL).
|
getForUpdate, getIncludeType, getSelectField, getUpdatefields, getWhereFields, setSuidTypeCondition start(Integer start)
start - Start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).Condition size(Integer size)
size - Fetch result size (>0).Condition setIncludeType(IncludeType includeType)
includeType - Condition op(String field, Op op, Object value)
field - Field nameop - operatorvalue - Value of the field.Condition opOn(String field, Op op, String value)
field - Field nameop - operatorvalue - Value of the field. Since 1.17 the type change from Object to String,Number.Condition opOn(String field, Op op, Number value)
field - Field nameop - operatorvalue - Value of the field. Since 1.17 the type change from Object to String,Number.Condition opWithField(String field1, Op op, String field2)
field1 - first field nameop - operatorfield2 - second field nameCondition and()
Condition or()
Condition lParentheses()
Condition rParentheses()
Condition between(String field, Number low, Number high)
field - low - high - Condition notBetween(String field, Number low, Number high)
field - low - high - Condition between(String field, String low, String high)
field - low - high - Condition notBetween(String field, String low, String high)
field - low - high - Condition having(FunctionType functionType, String field, Op op, Number value)
functionType - FunctionTypefield - Entity field,it will be translated according the config.op - operatorvalue - Value of the field.Condition orderBy(String field)
field - field name.Condition orderBy(String field, OrderType orderType)
field - Field name.orderType - order type(asc or desc)Condition orderBy(FunctionType functionType, String field, OrderType orderType)
functionType - Function type of SQL.field - Field name.orderType - order type(asc or desc)Condition setAdd(String field, Number num)
field - Field name.num - numberCondition setMultiply(String field, Number num)
field - Field name.num - numberCondition setAdd(String field, String otherFieldName)
field - Field name.otherFieldName - Condition setMultiply(String field, String otherFieldName)
field - Field name.otherFieldName - other fieldNameCondition set(String fieldName, Number num)
fieldName - field namenum - numberCondition set(String fieldName, String value)
fieldName - Field namevalue - Condition setWithField(String field1, String field2)
field1 - first field namefield2 - second field nameCondition selectField(String... fieldList)
fieldList - select fields,if more than one,separate with comma or use variable-length arguments.Condition selectDistinctField(String fieldName)
fieldName - Field nameCondition selectDistinctField(String fieldName, String alias)
fieldName - Field namealias - Name of aliasCondition selectFun(FunctionType functionType, String fieldForFun)
functionType - Function type of SQL.fieldForFun - Field name for function.Condition selectFun(FunctionType functionType, String fieldForFun, String alias)
functionType - Function type of SQL.fieldForFun - field name for function.alias - Name of alias for the function result.Condition forUpdate()
Copyright © 2025. All rights reserved.