public class Condition extends Object implements EntityTableName
| Modifier and Type | Field and Description |
|---|---|
protected String |
countColumn |
protected boolean |
distinct |
protected Class<?> |
entityClass |
protected Set<String> |
excludeColumns |
protected boolean |
exists |
protected boolean |
forUpdate |
protected boolean |
notNull |
protected OrderBy |
ORDERBY |
protected String |
orderByClause |
protected List<Criteria> |
oredCriteria |
protected Map<String,EntityColumn> |
propertyMap |
protected Set<String> |
selectColumns |
protected EntityTable |
table |
protected String |
tableName |
| Constructor and Description |
|---|
Condition(Class<?> clazz)
默认exists为true
|
Condition(Class<?> clazz,
boolean exists)
带exists参数的构造方法,默认notNull为false,允许为空
|
Condition(Class<?> entityClass,
boolean exists,
boolean notNull)
带exists参数的构造方法
|
| Modifier and Type | Method and Description |
|---|---|
Criteria |
and() |
void |
and(Criteria criteria) |
static Builder |
builder(Class<?> entityClass) |
void |
clear() |
Criteria |
createCriteria() |
protected Criteria |
createCriteriaInternal() |
Condition |
excludeProperties(String... properties)
排除查询字段,优先级低于 selectProperties
|
String |
getCountColumn() |
String |
getDynamicTableName()
获取动态表名 - 只要有返回值,不是null和'',就会用返回值作为表名
|
Class<?> |
getEntityClass() |
String |
getOrderByClause() |
List<Criteria> |
getOredCriteria() |
Set<String> |
getSelectColumns() |
boolean |
isDistinct() |
boolean |
isForUpdate() |
Criteria |
or() |
void |
or(Criteria criteria) |
OrderBy |
orderBy(String property) |
Condition |
selectProperties(String... properties)
指定要查询的属性列 - 这里会自动映射到表字段
|
void |
setCountProperty(String property)
指定 count(property) 查询属性
|
void |
setDistinct(boolean distinct) |
void |
setForUpdate(boolean forUpdate) |
void |
setOrderByClause(String orderByClause) |
void |
setTableName(String tableName)
设置表名
|
protected String orderByClause
protected boolean distinct
protected boolean exists
protected boolean notNull
protected boolean forUpdate
protected String countColumn
protected Class<?> entityClass
protected EntityTable table
protected Map<String,EntityColumn> propertyMap
protected String tableName
protected OrderBy ORDERBY
public Condition(Class<?> clazz)
clazz - 对象public Condition(Class<?> clazz, boolean exists)
clazz - 对象exists - - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件public Condition(Class<?> entityClass, boolean exists, boolean notNull)
entityClass - 对象exists - - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件notNull - - true时,如果值为空,就会抛出异常,false时,如果为空就不使用该字段的条件public Condition excludeProperties(String... properties)
properties - 属性名的可变参数public Condition selectProperties(String... properties)
properties - 属性名的可变参数public void or(Criteria criteria)
public Criteria or()
public void and(Criteria criteria)
public Criteria and()
public Criteria createCriteria()
protected Criteria createCriteriaInternal()
public void clear()
public String getCountColumn()
public String getDynamicTableName()
EntityTableNamegetDynamicTableName in interface EntityTableNamepublic Class<?> getEntityClass()
public String getOrderByClause()
public void setOrderByClause(String orderByClause)
public boolean isDistinct()
public void setDistinct(boolean distinct)
public boolean isForUpdate()
public void setForUpdate(boolean forUpdate)
public void setCountProperty(String property)
property - 属性public void setTableName(String tableName)
tableName - 表名Copyright © 2020. All rights reserved.