类 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
- 从以下版本开始:
- 2017-05-26
- 作者:
- hubin miemie HCL
- 另请参阅:
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明protected MergeSegmentsprotected SharedStringprotected SharedString其他protected AtomicInteger必要度量protected SharedStringSQL注释protected SharedStringSQL起始语句protected final Children占位符 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected ChildrenaddCondition(boolean condition, R column, SqlKeyword sqlKeyword, Object val) 普通查询条件protected ChildrenaddNestedCondition(boolean condition, Consumer<Children> consumer) 多重嵌套查询条件<V> ChildrenallEq(boolean condition, BiPredicate<R, V> filter, Map<R, V> params, boolean null2IsNull) 字段过滤接口,传入多参数时允许对参数进行过滤<V> Childrenmap 所有非空属性等于 =protected Childrenand(boolean condition) 内部自用AND 嵌套protected voidappendSqlSegments(ISqlSegment... sqlSegments) 添加 where 片段拼接 sqlBETWEEN 值1 AND 值2voidclear()条件清空clone()protected StringcolumnsToString(List<R> columns) 多字段转换为逗号 "," 分割字符串protected StringcolumnsToString(R... columns) 获取 columnNamesprotected final ColumnSegmentcolumnToSqlSegment(R column) 获取 columnNameprotected StringcolumnToString(R column) 获取 columnNamesql 注释(会拼接在 sql 的最后面)等于 =字段 EQ ( sql语句 )拼接 EXISTS ( sql语句 )sql 起始句(会拼接在SQL语句的起始处)protected final StringformatParam(String mapping, Object param) 处理入参protected final StringformatSqlMaybeWithParam(String sqlStr, Object... params) 格式化 sql消费函数大于等于 >=字段 >= ( sql语句 )实体对象(子类实现)获取 MergeSegmentsSQL 片段分组:GROUP BY 字段, ...分组:GROUP BY 字段, ...分组:GROUP BY 字段, ...分组:GROUP BY 字段, ...大于 >字段 > ( sql语句 )HAVING ( sql语句 )字段 IN (v0, v1, ...)in(boolean condition, R column, Collection<?> coll) 字段 IN (value.get(0), value.get(1), ...)protected ISqlSegmentinExpression(Object[] values) 获取in表达式 包含括号protected ISqlSegmentinExpression(Collection<?> value) 获取in表达式 包含括号protected voidinitNeed()必要的初始化字段 IN ( sql语句 )protected abstract Childreninstance()子类返回一个自己的新对象字段 IS NOT NULL字段 IS NULLboolean是否使用默认注解OrderBy排序无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)小于等于 <=字段 无效输入:'<'= ( sql语句 )LIKE '%值%'LIKE '%值'LIKE '值%'protected ChildrenlikeValue(boolean condition, SqlKeyword keyword, R column, Object val, SqlLike sqlLike) 内部自用小于 <字段 < ( sql语句 )protected final ChildrenmaybeDo(boolean condition, AbstractWrapper.DoSomething something) 函数化的做事不等于 <>正常嵌套 不带 AND 或者 ORprotected Childrennot(boolean condition) 内部自用not嵌套notBetween(boolean condition, R column, Object val1, Object val2) NOT BETWEEN 值1 AND 值2拼接 NOT EXISTS ( sql语句 )字段 NOT IN (v0, v1, ...)notIn(boolean condition, R column, Collection<?> coll) 字段 NOT IN (value.get(0), value.get(1), ...)字段 NOT IN ( sql语句 )NOT LIKE '%值%'notLikeLeft(boolean condition, R column, Object val) NOT LIKE '%值'notLikeRight(boolean condition, R column, Object val) NOT LIKE '值%'or(boolean condition) 拼接 OROR 嵌套排序:ORDER BY 字段, ...排序:ORDER BY 字段, ...排序:ORDER BY 字段, ...排序:ORDER BY 字段, ...setEntityClass(Class<T> entityClass) setParamAlias(String paramAlias) 参数别名设置,初始化时优先设置该值、重复设置异常从类继承的方法 com.baomidou.mybatisplus.core.conditions.Wrapper
getCustomSqlSegment, getSqlSelect, getSqlSet, getTargetSql, isEmptyOfEntity, isEmptyOfNormal, isEmptyOfWhere, isNonEmptyOfEntity, isNonEmptyOfNormal, isNonEmptyOfWhere, 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, notLikeLeft, notLikeRight从接口继承的方法 com.baomidou.mybatisplus.core.conditions.interfaces.Func
eqSql, func, geSql, groupBy, groupBy, groupBy, gtSql, having, in, in, inSql, isNotNull, isNull, leSql, ltSql, notIn, notIn, notInSql, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDesc
-
字段详细资料
-
typedThis
占位符 -
paramNameSeq
必要度量 -
paramNameValuePairs
-
paramAlias
其他 -
lastSql
-
sqlComment
SQL注释 -
sqlFirst
SQL起始语句 -
expression
-
-
构造器详细资料
-
AbstractWrapper
public AbstractWrapper()
-
-
方法详细资料
-
getEntity
从类复制的说明:Wrapper实体对象(子类实现) -
setEntity
-
getEntityClass
-
setEntityClass
-
allEq
从接口复制的说明:Comparemap 所有非空属性等于 = -
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
从接口复制的说明:CompareLIKE '%值%' -
notLike
从接口复制的说明:CompareNOT LIKE '%值%' -
likeLeft
从接口复制的说明:CompareLIKE '%值' -
likeRight
从接口复制的说明:CompareLIKE '值%' -
notLikeLeft
从接口复制的说明:CompareNOT LIKE '%值'- 指定者:
notLikeLeft在接口中Compare<T,R> - 参数:
condition- 执行条件column- 字段val- 值- 返回:
- children
-
notLikeRight
从接口复制的说明:CompareNOT LIKE '值%'- 指定者:
notLikeRight在接口中Compare<T,R> - 参数:
condition- 执行条件column- 字段val- 值- 返回:
- children
-
between
从接口复制的说明:CompareBETWEEN 值1 AND 值2 -
notBetween
从接口复制的说明:CompareNOT BETWEEN 值1 AND 值2- 指定者:
notBetween在接口中Compare<T,R> - 参数:
condition- 执行条件column- 字段val1- 值1val2- 值2- 返回:
- children
-
and
从接口复制的说明:NestedAND 嵌套例: and(i -> i.eq("name", "李白").ne("status", "活着"))
-
or
从接口复制的说明:NestedOR 嵌套例: or(i -> i.eq("name", "李白").ne("status", "活着"))
-
nested
从接口复制的说明:Nested正常嵌套 不带 AND 或者 OR例: nested(i -> i.eq("name", "李白").ne("status", "活着"))
-
not
从接口复制的说明:Nestednot嵌套例: 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())
例4: apply("type={0,javaType=int,jdbcType=NUMERIC,typeHandler=xxx.xxx.MyTypeHandler}", "待处理字符串")
-
last
从接口复制的说明:Join无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)例: last("limit 1")
注意只能调用一次,多次调用以最后一次为准
-
comment
从接口复制的说明:Joinsql 注释(会拼接在 sql 的最后面)自3.5.6开始,默认不处理转义字符,如有需要,调用
StringEscape.escapeRawString(String) -
first
从接口复制的说明:Joinsql 起始句(会拼接在SQL语句的起始处)自3.5.6开始,默认不处理转义字符,如有需要,调用
StringEscape.escapeRawString(String) -
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(true, "name")
-
isNotNull
从接口复制的说明:Func字段 IS NOT NULL例: isNotNull(true, "name")
-
in
从接口复制的说明:Func字段 IN (value.get(0), value.get(1), ...)例: in(true, "id", Arrays.asList(1, 2, 3, 4, 5))
- 注意!当集合为 空或null 时, sql会拼接为:WHERE (字段名 IN ()), 执行时报错
- 若要在特定条件下不拼接, 可在 condition 条件中判断
-
in
从接口复制的说明:Func字段 IN (v0, v1, ...)例: in(true, "id", 1, 2, 3, 4, 5)
- 注意!当数组为 空或null 时, sql会拼接为:WHERE (字段名 IN ()), 执行时报错
- 若要在特定条件下不拼接, 可在 condition 条件中判断
-
notIn
从接口复制的说明:Func字段 NOT IN (value.get(0), value.get(1), ...)例: notIn(true, "id", Arrays.asList(1, 2, 3, 4, 5))
- 注意!当集合为 空或null 时, sql会拼接为:WHERE (字段名 NOT IN ()), 执行时报错
- 若要在特定条件下不拼接, 可在 condition 条件中判断
-
notIn
从接口复制的说明:Func字段 NOT IN (v0, v1, ...)例: notIn(true, "id", 1, 2, 3, 4, 5)
- 注意!当数组为 空或null 时, sql会拼接为:WHERE (字段名 NOT IN ()), 执行时报错
- 若要在特定条件下不拼接, 可在 condition 条件中判断
-
eqSql
从接口复制的说明:Func字段 EQ ( sql语句 )!! sql 注入方式的 eq 方法 !!
例1: eqSql("id", "1")
例2: eqSql("id", "select MAX(id) from table")
-
inSql
从接口复制的说明:Func字段 IN ( sql语句 )!! sql 注入方式的 in 方法 !!
例1: inSql(true, "id", "1")
例2: inSql(true, "id", "select id from table where id < 3")
-
gtSql
从接口复制的说明:Func字段 > ( sql语句 )例1: gtSql(true, "id", "1")
例1: gtSql(true, "id", "select id from table where name = 'JunJun'")
-
geSql
从接口复制的说明:Func字段 >= ( sql语句 )例1: geSql(true, "id", "1")
例1: geSql(true, "id", "select id from table where name = 'JunJun'")
-
ltSql
从接口复制的说明:Func字段 < ( sql语句 )例1: ltSql(true, "id", "1")
例1: ltSql(true , "id", "select id from table where name = 'JunJun'")
-
leSql
从接口复制的说明:Func字段 无效输入:'<'= ( sql语句 )例1: leSql(true, "id", "1")
例1: leSql(true ,"id", "select id from table where name = 'JunJun'")
-
notInSql
从接口复制的说明:Func字段 NOT IN ( sql语句 )!! sql 注入方式的 not in 方法 !!
例1: notInSql(true, "id", "1, 2, 3, 4, 5, 6")
例2: notInSql(true, "id", "select id from table where id < 3")
-
groupBy
从接口复制的说明:Func分组:GROUP BY 字段, ...例: groupBy(true, "id", "name")
-
groupBy
从接口复制的说明:Func分组:GROUP BY 字段, ...例: groupBy(true, "id", Arrays.asList("name"))
-
doGroupBy
-
doOrderBy
-
orderBy
从接口复制的说明:Func排序:ORDER BY 字段, ... -
orderBy
从接口复制的说明:Func排序:ORDER BY 字段, ... -
groupBy
从接口复制的说明:Func分组:GROUP BY 字段, ...例: groupBy(true, "id")
-
groupBy
从接口复制的说明:Func分组:GROUP BY 字段, ...例: groupBy(true, Arrays.asList("id", "name"))
-
orderBy
从接口复制的说明:Func排序:ORDER BY 字段, ...例: orderBy(true, "id")
-
orderBy
从接口复制的说明:Func排序:ORDER BY 字段, ...例: orderBy(true, Arrays.asList("id", "name"))
-
having
从接口复制的说明:FuncHAVING ( sql语句 )例1: having(true, "sum(age) > 10")
例2: having(true, "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
子类返回一个自己的新对象 -
formatSqlMaybeWithParam
格式化 sql支持 "{0}" 这种,或者 "sql {0} sql" 这种 也支持 "sql {0,javaType=int,jdbcType=NUMERIC,typeHandler=xxx.xxx.MyTypeHandler} sql" 这种
- 参数:
sqlStr- 可能是sql片段params- 参数- 返回:
- sql片段
-
formatParam
处理入参- 参数:
mapping- 例如: "javaType=int,jdbcType=NUMERIC,typeHandler=xxx.xxx.MyTypeHandler" 这种param- 参数- 返回:
- value
-
maybeDo
函数化的做事- 参数:
condition- 做不做something- 做什么- 返回:
- Children
-
inExpression
获取in表达式 包含括号- 参数:
value- 集合
-
inExpression
获取in表达式 包含括号- 参数:
values- 数组
-
initNeed
protected void initNeed()必要的初始化 -
clear
public void clear()从类复制的说明:Wrapper条件清空 -
appendSqlSegments
添加 where 片段- 参数:
sqlSegments- ISqlSegment 数组
-
isUseAnnotationOrderBy
public boolean isUseAnnotationOrderBy()是否使用默认注解OrderBy排序- 返回:
- true 使用 false 不使用
-
getSqlSegment
从接口复制的说明:ISqlSegmentSQL 片段- 指定者:
getSqlSegment在接口中ISqlSegment
-
getSqlComment
- 覆盖:
getSqlComment在类中Wrapper<T>
-
getSqlFirst
- 覆盖:
getSqlFirst在类中Wrapper<T>
-
getExpression
从类复制的说明:Wrapper获取 MergeSegments- 指定者:
getExpression在类中Wrapper<T>
-
getParamAlias
-
setParamAlias
参数别名设置,初始化时优先设置该值、重复设置异常- 参数:
paramAlias- 参数别名- 返回:
- Children
-
columnToSqlSegment
获取 columnName -
columnToString
获取 columnName -
columnsToString
获取 columnNames -
columnsToString
多字段转换为逗号 "," 分割字符串- 参数:
columns- 多字段
-
clone
-
getParamNameValuePairs
-