public class Example extends Object implements IDynamicTableName
| 限定符和类型 | 类和说明 |
|---|---|
static class |
Example.Criteria |
static class |
Example.Criterion |
protected static class |
Example.GeneratedCriteria |
static class |
Example.OrderBy |
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
countColumn |
protected boolean |
distinct |
protected Class<?> |
entityClass |
protected Set<String> |
excludeColumns |
protected boolean |
exists |
protected boolean |
forUpdate |
protected boolean |
notNull |
protected Example.OrderBy |
ORDERBY |
protected String |
orderByClause |
protected List<Example.Criteria> |
oredCriteria |
protected Map<String,EntityColumn> |
propertyMap |
protected Set<String> |
selectColumns |
protected EntityTable |
table |
protected String |
tableName |
| 构造器和说明 |
|---|
Example(Class<?> entityClass)
默认exists为true
|
Example(Class<?> entityClass,
boolean exists)
带exists参数的构造方法,默认notNull为false,允许为空
|
Example(Class<?> entityClass,
boolean exists,
boolean notNull)
带exists参数的构造方法
|
| 限定符和类型 | 方法和说明 |
|---|---|
Example.Criteria |
and() |
void |
and(Example.Criteria criteria) |
void |
clear() |
Example.Criteria |
createCriteria() |
protected Example.Criteria |
createCriteriaInternal() |
Example |
excludeProperties(String... properties)
排除查询字段,优先级低于 selectProperties
|
String |
getCountColumn() |
String |
getDynamicTableName()
获取动态表名 - 只要有返回值,不是null和'',就会用返回值作为表名
|
Class<?> |
getEntityClass() |
String |
getOrderByClause() |
List<Example.Criteria> |
getOredCriteria() |
Set<String> |
getSelectColumns() |
boolean |
isDistinct() |
boolean |
isForUpdate() |
Example.Criteria |
or() |
void |
or(Example.Criteria criteria) |
Example.OrderBy |
orderBy(String property) |
Example |
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 List<Example.Criteria> oredCriteria
protected Class<?> entityClass
protected EntityTable table
protected Map<String,EntityColumn> propertyMap
protected String tableName
protected Example.OrderBy ORDERBY
public Example(Class<?> entityClass)
entityClass - public Example(Class<?> entityClass, boolean exists)
entityClass - exists - - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件public Example(Class<?> entityClass, boolean exists, boolean notNull)
entityClass - exists - - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件notNull - - true时,如果值为空,就会抛出异常,false时,如果为空就不使用该字段的条件public Class<?> getEntityClass()
public String getOrderByClause()
public void setOrderByClause(String orderByClause)
public Example.OrderBy orderBy(String property)
public Example excludeProperties(String... properties)
properties - 属性名的可变参数public Example selectProperties(String... properties)
properties - public String getCountColumn()
public void setCountProperty(String property)
property - public boolean isDistinct()
public void setDistinct(boolean distinct)
public boolean isForUpdate()
public void setForUpdate(boolean forUpdate)
public List<Example.Criteria> getOredCriteria()
public void or(Example.Criteria criteria)
public Example.Criteria or()
public void and(Example.Criteria criteria)
public Example.Criteria and()
public Example.Criteria createCriteria()
protected Example.Criteria createCriteriaInternal()
public void clear()
public void setTableName(String tableName)
tableName - public String getDynamicTableName()
IDynamicTableNamegetDynamicTableName 在接口中 IDynamicTableNameCopyright © 2017. All rights reserved.