Package cn.lm.mybatis.mapper.entity
Class Condition<T>
java.lang.Object
cn.lm.mybatis.mapper.entity.Condition<T>
- All Implemented Interfaces:
IDynamicTableName
通用的Example查询对象
- Author:
- liuzh
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classprotected static classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected booleanprotected booleanprotected booleanprotected booleanprotected Condition.OrderBy<T>protected Stringprotected List<Condition.Criteria<T>>protected Map<String,EntityColumn> protected EntityTableprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionand()voidand(Condition.Criteria<T> criteria) static <T1> Condition.Builder<T1>voidclear()protected Condition.Criteria<T>excludeProperties(SFunction<T, ?>... columns) excludeProperties(String... properties) 排除查询字段,优先级低于 selectPropertiesprotected StringgetColumnCache(SFunction<T, ?> column) 获取 SerializedLambda 对应的列信息,从 lambda 表达式中推测实体类获取动态表名 - 只要有返回值,不是null和'',就会用返回值作为表名Class<?>booleanbooleanor()voidor(Condition.Criteria<T> criteria) selectProperties(SFunction<T, ?>... columns) selectProperties(String... properties) 指定要查询的属性列 - 这里会自动映射到表字段voidsetCountProperty(SFunction<T, ?> column) voidsetCountProperty(String property) 指定 count(property) 查询属性voidsetDistinct(boolean distinct) voidsetForUpdate(boolean forUpdate) voidsetOrderByClause(String orderByClause) voidsetTableName(String tableName) 设置表名
-
Field Details
-
orderByClause
-
distinct
protected boolean distinct -
exists
protected boolean exists -
notNull
protected boolean notNull -
forUpdate
protected boolean forUpdate -
selectColumns
-
excludeColumns
-
countColumn
-
oredCriteria
-
entityClass
-
table
-
propertyMap
-
tableName
-
ORDERBY
-
-
Constructor Details
-
Condition
默认exists为true- Parameters:
entityClass-
-
Condition
带exists参数的构造方法,默认notNull为false,允许为空- Parameters:
entityClass-exists- - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件
-
Condition
带exists参数的构造方法- Parameters:
entityClass-exists- - true时,如果字段不存在就抛出异常,false时,如果不存在就不使用该字段的条件notNull- - true时,如果值为空,就会抛出异常,false时,如果为空就不使用该字段的条件
-
-
Method Details
-
builder
-
orderBy
-
orderBy
-
excludeProperties
-
excludeProperties
排除查询字段,优先级低于 selectProperties- Parameters:
properties- 属性名的可变参数- Returns:
-
selectProperties
-
selectProperties
指定要查询的属性列 - 这里会自动映射到表字段- Parameters:
properties-- Returns:
-
or
-
or
-
and
-
and
-
createCriteria
-
createCriteriaInternal
-
clear
public void clear() -
getPropertyMap
-
getCountColumn
-
getDynamicTableName
Description copied from interface:IDynamicTableName获取动态表名 - 只要有返回值,不是null和'',就会用返回值作为表名- Specified by:
getDynamicTableNamein interfaceIDynamicTableName- Returns:
-
getEntityClass
-
getOrderByClause
-
setOrderByClause
-
getOredCriteria
-
getSelectColumns
-
getColumnCache
获取 SerializedLambda 对应的列信息,从 lambda 表达式中推测实体类如果获取不到列信息,那么本次条件组装将会失败
- Returns:
- 列
- Throws:
NullPointerException- 获取不到列信息时抛出异常
-
isDistinct
public boolean isDistinct() -
setDistinct
public void setDistinct(boolean distinct) -
isForUpdate
public boolean isForUpdate() -
setForUpdate
public void setForUpdate(boolean forUpdate) -
setCountProperty
-
setCountProperty
指定 count(property) 查询属性- Parameters:
property-
-
setTableName
设置表名- Parameters:
tableName-
-