类 AbstractWrapper<T,R,Children extends AbstractWrapper<T,R,Children>>
- 所有已实现的接口:
Compare<Children,R>
,Func<Children,R>
,Join<Children>
,Nested<Children,Children>
,ISqlSegment
,Serializable
- 直接已知子类:
AbstractLambdaWrapper
,QueryWrapper
,UpdateWrapper
public abstract class AbstractWrapper<T,R,Children extends AbstractWrapper<T,R,Children>> extends Wrapper<T> implements Compare<Children,R>, Nested<Children,Children>, Join<Children>, Func<Children,R>
- 从以下版本开始:
- 2017-05-26
- 作者:
- hubin miemie HCL
- 另请参阅:
- 序列化表格
-
字段概要
字段 修饰符和类型 字段 说明 protected MergeSegments
expression
protected SharedString
lastSql
protected AtomicInteger
paramNameSeq
必要度量protected Map<String,Object>
paramNameValuePairs
protected SharedString
sqlComment
SQL注释protected SharedString
sqlFirst
SQL起始语句protected Children
typedThis
占位符 -
构造器概要
构造器 构造器 说明 AbstractWrapper()
-
方法概要
修饰符和类型 方法 说明 protected Children
addCondition(boolean condition, R column, SqlKeyword sqlKeyword, Object val)
普通查询条件protected Children
addNestedCondition(boolean condition, Consumer<Children> consumer)
多重嵌套查询条件<V> Children
allEq(boolean condition, BiPredicate<R,V> filter, Map<R,V> params, boolean null2IsNull)
字段过滤接口,传入多参数时允许对参数进行过滤<V> Children
allEq(boolean condition, Map<R,V> params, boolean null2IsNull)
map 所有非空属性等于 =protected Children
and(boolean condition)
内部自用Children
and(boolean condition, Consumer<Children> consumer)
AND 嵌套Children
apply(boolean condition, String applySql, Object... value)
拼接 sqlChildren
between(boolean condition, R column, Object val1, Object val2)
BETWEEN 值1 AND 值2void
clear()
条件清空Children
clone()
protected String
columnsToString(R... columns)
多字段转换为逗号 "," 分割字符串protected String
columnToString(R column)
获取 columnNameChildren
comment(boolean condition, String comment)
sql 注释(会拼接在 sql 的最后面)protected Children
doIt(boolean condition, ISqlSegment... sqlSegments)
对sql片段进行组装Children
eq(boolean condition, R column, Object val)
等于 =Children
exists(boolean condition, String existsSql)
拼接 EXISTS ( sql语句 )Children
first(boolean condition, String firstSql)
sql 起始句(会拼接在SQL语句的起始处)protected String
formatSql(String sqlStr, Object... params)
格式化SQLprotected String
formatSqlIfNeed(boolean need, String sqlStr, Object... params)
根据需要格式化SQL
Format SQL for methods: EntityQ.where/and/or... Children
func(boolean condition, Consumer<Children> consumer)
消费函数Children
ge(boolean condition, R column, Object val)
大于等于 >=T
getEntity()
实体对象(子类实现)Class<T>
getEntityClass()
MergeSegments
getExpression()
获取 MergeSegmentsMap<String,Object>
getParamNameValuePairs()
String
getSqlComment()
String
getSqlFirst()
String
getSqlSegment()
SQL 片段Children
groupBy(boolean condition, R... columns)
分组:GROUP BY 字段, ...Children
gt(boolean condition, R column, Object val)
大于 >Children
having(boolean condition, String sqlHaving, Object... params)
HAVING ( sql语句 )Children
in(boolean condition, R column, Collection<?> coll)
字段 IN (value.get(0), value.get(1), ...)protected void
initNeed()
必要的初始化Children
inSql(boolean condition, R column, String inValue)
字段 IN ( sql语句 )protected abstract Children
instance()
子类返回一个自己的新对象Children
isNotNull(boolean condition, R column)
字段 IS NOT NULLChildren
isNull(boolean condition, R column)
字段 IS NULLChildren
last(boolean condition, String lastSql)
无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)Children
le(boolean condition, R column, Object val)
小于等于 <=Children
like(boolean condition, R column, Object val)
LIKE '%值%'Children
likeLeft(boolean condition, R column, Object val)
LIKE '%值'Children
likeRight(boolean condition, R column, Object val)
LIKE '值%'protected Children
likeValue(boolean condition, SqlKeyword keyword, R column, Object val, SqlLike sqlLike)
内部自用Children
lt(boolean condition, R column, Object val)
小于 <Children
ne(boolean condition, R column, Object val)
不等于 <>Children
nested(boolean condition, Consumer<Children> consumer)
正常嵌套 不带 AND 或者 ORprotected Children
not(boolean condition)
内部自用Children
not(boolean condition, Consumer<Children> consumer)
not嵌套Children
notBetween(boolean condition, R column, Object val1, Object val2)
NOT BETWEEN 值1 AND 值2Children
notExists(boolean condition, String existsSql)
拼接 NOT EXISTS ( sql语句 )Children
notIn(boolean condition, R column, Collection<?> coll)
字段 NOT IN (value.get(0), value.get(1), ...)Children
notInSql(boolean condition, R column, String inValue)
字段 NOT IN ( sql语句 )Children
notLike(boolean condition, R column, Object val)
NOT LIKE '%值%'Children
or(boolean condition)
拼接 ORChildren
or(boolean condition, Consumer<Children> consumer)
OR 嵌套Children
orderBy(boolean condition, boolean isAsc, R... columns)
排序:ORDER BY 字段, ...Children
setEntity(T entity)
Children
setEntityClass(Class<T> entityClass)
从类继承的方法 com.baomidou.mybatisplus.core.conditions.Wrapper
getCustomSqlSegment, getSqlSelect, getSqlSet, getTargetSql, isEmptyOfEntity, isEmptyOfNormal, isEmptyOfWhere, nonEmptyOfEntity, nonEmptyOfNormal, nonEmptyOfWhere
从类继承的方法 java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 com.baomidou.mybatisplus.core.conditions.interfaces.Compare
allEq, allEq, allEq, allEq, between, eq, ge, gt, le, like, likeLeft, likeRight, lt, ne, notBetween, notLike
从接口继承的方法 com.baomidou.mybatisplus.core.conditions.interfaces.Func
func, groupBy, groupBy, having, in, in, in, inSql, isNotNull, isNull, notIn, notIn, notIn, notInSql, orderByAsc, orderByAsc, orderByAsc, orderByDesc, orderByDesc, orderByDesc
-
字段详细资料
-
typedThis
占位符 -
paramNameSeq
必要度量 -
paramNameValuePairs
-
lastSql
-
sqlComment
SQL注释 -
sqlFirst
SQL起始语句 -
expression
-
-
构造器详细资料
-
AbstractWrapper
public AbstractWrapper()
-
-
方法详细资料
-
getEntity
从类复制的说明:Wrapper
实体对象(子类实现) -
setEntity
-
getEntityClass
-
setEntityClass
-
allEq
从接口复制的说明:Compare
map 所有非空属性等于 = -
allEq
public <V> Children allEq(boolean condition, BiPredicate<R,V> filter, Map<R,V> params, boolean null2IsNull)从接口复制的说明:Compare
字段过滤接口,传入多参数时允许对参数进行过滤 -
eq
从接口复制的说明:Compare
等于 = -
ne
从接口复制的说明:Compare
不等于 <> -
gt
从接口复制的说明:Compare
大于 > -
ge
从接口复制的说明:Compare
大于等于 >= -
lt
从接口复制的说明:Compare
小于 < -
le
从接口复制的说明:Compare
小于等于 <= -
like
从接口复制的说明:Compare
LIKE '%值%' -
notLike
从接口复制的说明:Compare
NOT LIKE '%值%' -
likeLeft
从接口复制的说明:Compare
LIKE '%值' -
likeRight
从接口复制的说明:Compare
LIKE '值%' -
between
从接口复制的说明:Compare
BETWEEN 值1 AND 值2 -
notBetween
从接口复制的说明:Compare
NOT BETWEEN 值1 AND 值2- 指定者:
notBetween
在接口中Compare<T,R>
- 参数:
condition
- 执行条件column
- 字段val1
- 值1val2
- 值2- 返回:
- children
-
and
从接口复制的说明:Nested
AND 嵌套例: and(i -> i.eq("name", "李白").ne("status", "活着"))
-
or
从接口复制的说明:Nested
OR 嵌套例: or(i -> i.eq("name", "李白").ne("status", "活着"))
-
nested
从接口复制的说明:Nested
正常嵌套 不带 AND 或者 OR例: nested(i -> i.eq("name", "李白").ne("status", "活着"))
-
not
从接口复制的说明:Nested
not嵌套例: not(i -> i.eq("name", "李白").ne("status", "活着"))
-
or
从接口复制的说明:Join
拼接 OR -
apply
从接口复制的说明:Join
拼接 sql!! 会有 sql 注入风险 !!
例1: apply("id = 1")
例2: apply("date_format(dateColumn,'%Y-%m-%d') = '2008-08-08'")
例3: apply("date_format(dateColumn,'%Y-%m-%d') = {0}", LocalDate.now())
-
last
从接口复制的说明:Join
无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)例: last("limit 1")
注意只能调用一次,多次调用以最后一次为准
-
comment
从接口复制的说明:Join
sql 注释(会拼接在 sql 的最后面) -
first
从接口复制的说明:Join
sql 起始句(会拼接在SQL语句的起始处) -
exists
从接口复制的说明:Join
拼接 EXISTS ( sql语句 )!! sql 注入方法 !!
例: exists("select id from table where age = 1")
-
notExists
从接口复制的说明:Join
拼接 NOT EXISTS ( sql语句 )!! sql 注入方法 !!
例: notExists("select id from table where age = 1")
-
isNull
从接口复制的说明:Func
字段 IS NULL例: isNull("name")
-
isNotNull
从接口复制的说明:Func
字段 IS NOT NULL例: isNotNull("name")
-
in
从接口复制的说明:Func
字段 IN (value.get(0), value.get(1), ...)例: in("id", Arrays.asList(1, 2, 3, 4, 5))
- 如果集合为 empty 则不会进行 sql 拼接
-
notIn
从接口复制的说明:Func
字段 NOT IN (value.get(0), value.get(1), ...)例: notIn("id", Arrays.asList(1, 2, 3, 4, 5))
-
inSql
从接口复制的说明:Func
字段 IN ( sql语句 )!! sql 注入方式的 in 方法 !!
例1: inSql("id", "1, 2, 3, 4, 5, 6")
例2: inSql("id", "select id from table where id < 3")
-
notInSql
从接口复制的说明:Func
字段 NOT IN ( sql语句 )!! sql 注入方式的 not in 方法 !!
例1: notInSql("id", "1, 2, 3, 4, 5, 6")
例2: notInSql("id", "select id from table where id < 3")
-
groupBy
从接口复制的说明:Func
分组:GROUP BY 字段, ...例: groupBy("id", "name")
-
orderBy
从接口复制的说明:Func
排序:ORDER BY 字段, ...例: orderBy(true, "id", "name")
-
having
从接口复制的说明:Func
HAVING ( sql语句 )例1: having("sum(age) > 10")
例2: having("sum(age) > {0}", 10)
-
func
从接口复制的说明:Func
消费函数 -
not
内部自用NOT 关键词
-
and
内部自用拼接 AND
-
likeValue
protected Children likeValue(boolean condition, SqlKeyword keyword, R column, Object val, SqlLike sqlLike)内部自用拼接 LIKE 以及 值
-
addCondition
普通查询条件- 参数:
condition
- 是否执行column
- 属性sqlKeyword
- SQL 关键词val
- 条件值
-
addNestedCondition
多重嵌套查询条件- 参数:
condition
- 查询条件值
-
instance
子类返回一个自己的新对象 -
formatSql
格式化SQL- 参数:
sqlStr
- SQL语句部分params
- 参数集- 返回:
- sql
-
formatSqlIfNeed
根据需要格式化SQL
Format SQL for methods: EntityQ.where/and/or...("name={0}", value); ALL the {i} will be replaced with #{MPGENVALi}
ew.where("sample_name={0}", "haha").and("sample_age >{0} and sample_age<{1}", 18, 30) TO sample_name=#{MPGENVAL1} and sample_age>#{MPGENVAL2} and sample_age<#{MPGENVAL3}
- 参数:
need
- 是否需要格式化sqlStr
- SQL语句部分params
- 参数集- 返回:
- sql
-
initNeed
protected void initNeed()必要的初始化 -
clear
public void clear()从类复制的说明:Wrapper
条件清空 -
doIt
对sql片段进行组装- 参数:
condition
- 是否执行sqlSegments
- sql片段数组- 返回:
- children
-
getSqlSegment
从接口复制的说明:ISqlSegment
SQL 片段- 指定者:
getSqlSegment
在接口中ISqlSegment
-
getSqlComment
- 覆盖:
getSqlComment
在类中Wrapper<T>
-
getSqlFirst
- 覆盖:
getSqlFirst
在类中Wrapper<T>
-
getExpression
从类复制的说明:Wrapper
获取 MergeSegments- 指定者:
getExpression
在类中Wrapper<T>
-
getParamNameValuePairs
-
columnToString
获取 columnName -
columnsToString
多字段转换为逗号 "," 分割字符串- 参数:
columns
- 多字段
-
clone
-