Class KtAbstractWrapper<T,Children extends KtAbstractWrapper<T,Children>>
- All Implemented Interfaces:
com.baomidou.mybatisplus.core.conditions.interfaces.Nested<Children,,Children> com.baomidou.mybatisplus.core.conditions.ISqlSegment,Compare<Children>,CompareIfExists<Children>,Func<Children>,OnCompare<Children>,CompareStr<Children,,String> CompareStrIfExists<Children,,String> FuncStr<Children,,String> Join<Children>,Serializable
- Direct Known Subclasses:
KtAbstractLambdaWrapper
AbstractWrapper- Author:
- yulichang
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean检查 SQL 注入过滤protected com.baomidou.mybatisplus.core.conditions.segments.MergeSegmentsprotected BiPredicate<Object,IfExistsSqlKeyWordEnum> IfExists 策略protected Integer表别名protected boolean主表wrapperprotected boolean是否是OnWrapperprotected Class<?>连表实体类 on 条件 func 使用protected com.baomidou.mybatisplus.core.conditions.SharedStringON sql wrapper集合protected com.baomidou.mybatisplus.core.conditions.SharedString其他protected AtomicInteger必要度量protected com.baomidou.mybatisplus.core.conditions.SharedStringSQL注释protected com.baomidou.mybatisplus.core.conditions.SharedStringSQL起始语句protected TableList关联的表protected String连表表名protected final Children占位符 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ChildrenaddCondition(boolean condition, String column, com.baomidou.mybatisplus.core.enums.SqlKeyword sqlKeyword, Object val) protected ChildrenaddCondition(boolean condition, String alias, kotlin.reflect.KProperty<?> column, com.baomidou.mybatisplus.core.enums.SqlKeyword sqlKeyword, Object val) 普通查询条件protected <X,S> Children addCondition(boolean condition, String alias, kotlin.reflect.KProperty<?> column, com.baomidou.mybatisplus.core.enums.SqlKeyword sqlKeyword, String rightAlias, kotlin.reflect.KProperty<?> val) protected ChildrenaddNestedCondition(boolean condition, Consumer<Children> consumer) 多重嵌套查询条件map 所有非空属性等于 =<V> ChildrenallEqStr(boolean condition, BiPredicate<String, V> filter, Map<String, V> params, boolean null2IsNull) 字段过滤接口,传入多参数时允许对参数进行过滤<V> Childrenmap 所有非空属性等于 =protected Childrenand(boolean condition) 内部自用protected voidappendSqlSegments(com.baomidou.mybatisplus.core.conditions.ISqlSegment... sqlSegments) 添加 where 片段拼接 sqlapplyFunc(boolean condition, String applySql, Function<FuncArgs, SelectFunc.Arg[]> consumerFunction, Object... values) sql 起始句 和介绍语句(会拼接在SQL语句的起始处和结束处)BETWEEN 值1 AND 值2between(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val1, Object val2) BETWEEN 值1 AND 值2开启检查 SQL 注入voidclear()clone()protected kotlin.reflect.KProperty<?>columnSqlInjectFilter(kotlin.reflect.KProperty<?> column) 字段 SQL 注入过滤处理,子类重写实现过滤逻辑protected StringcolumnsToString(Integer index, PrefixEnum prefixEnum, String alias, List<kotlin.reflect.KProperty<?>> columns) protected StringcolumnsToString(Integer index, PrefixEnum prefixEnum, String alias, kotlin.reflect.KProperty<?>... columns) 多字段转换为逗号 "," 分割字符串protected StringcolumnsToString(String... columns) protected StringcolumnsToString(List<String> columns) protected final com.baomidou.mybatisplus.core.conditions.ISqlSegmentcolumnToSqlSegment(Integer index, String alias, kotlin.reflect.KProperty<?> column) 获取 columnNameprotected final com.baomidou.mybatisplus.core.conditions.ISqlSegmentcolumnToSqlSegment(String column) protected final com.baomidou.mybatisplus.core.conditions.ISqlSegmentcolumnToSqlSegmentS(Integer index, String alias, kotlin.reflect.KProperty<?> column, boolean isJoin) protected StringcolumnToString(String column) sql 注释(会拼接在 sql 的最后面)等于 =等于 =eq(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) 等于 =字段 = ( sql语句 )拼接 EXISTS ( sql语句 )sql 起始句(会拼接在SQL语句的起始处)protected final StringformatParam(String mapping, Object param) 处理入参protected final StringformatSqlMaybeWithParam(String sqlStr, Object... params) 格式化 sql大于等于 >=大于等于 >=ge(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) 大于等于 >=字段 >= ( sql语句 )字段 >= ( sql语句 )com.baomidou.mybatisplus.core.conditions.segments.MergeSegments分组:GROUP BY 字段, ...分组:GROUP BY 字段, ...分组:GROUP BY 字段, ...groupByStr(boolean condition, List<String> columns) 分组:GROUP BY 字段, ...大于 >大于 >gt(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) 大于 >字段 > ( sql语句 )字段 > ( sql语句 )HAVING ( sql语句 )字段 IN (v0, v1, ...)in(boolean condition, String column, Collection<?> coll) 字段 IN (value.get(0), value.get(1), ...)字段 IN (v0, v1, ...)in(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Collection<?> coll) 字段 IN (value.get(0), value.get(1), ...)protected com.baomidou.mybatisplus.core.conditions.ISqlSegmentinExpression(Object[] values) 获取in表达式 包含括号protected com.baomidou.mybatisplus.core.conditions.ISqlSegmentinExpression(Collection<?> value) 获取in表达式 包含括号字段 IN ( sql语句 )字段 IN ( sql语句 )protected abstract Childreninstance()子类返回一个自己的新对象protected abstract Childrenprotected abstract Children字段 IS NOT NULL字段 IS NOT NULL字段 IS NULL字段 IS NULL无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)小于等于 <=小于等于 <=le(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) 小于等于 <=字段 <= ( sql语句 )字段 <= ( sql语句 )LIKE '%值%'LIKE '%值%'LIKE '%值'LIKE '%值'LIKE '值%'LIKE '值%'protected ChildrenlikeValue(boolean condition, com.baomidou.mybatisplus.core.enums.SqlKeyword keyword, String column, Object val, com.baomidou.mybatisplus.core.enums.SqlLike sqlLike) protected ChildrenlikeValue(boolean condition, com.baomidou.mybatisplus.core.enums.SqlKeyword keyword, String alias, kotlin.reflect.KProperty<?> column, Object val, com.baomidou.mybatisplus.core.enums.SqlLike sqlLike) 内部自用小于 <小于 <lt(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) 小于 <字段 < ( sql语句 )字段 < ( sql语句 )protected final ChildrenmaybeDo(boolean condition, DoSomething something) 函数化的做事不等于 <>不等于 <>ne(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) 不等于 <>protected Childrennot(boolean condition) 内部自用notBetween(boolean condition, String column, Object val1, Object val2) NOT BETWEEN 值1 AND 值2notBetween(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val1, Object val2) NOT BETWEEN 值1 AND 值2拼接 NOT EXISTS ( sql语句 )字段 NOT IN (v0, v1, ...)notIn(boolean condition, String column, Collection<?> coll) 字段 NOT IN (value.get(0), value.get(1), ...)字段 NOT IN (v0, v1, ...)notIn(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Collection<?> coll) 字段 NOT IN (value.get(0), value.get(1), ...)字段 NOT IN ( sql语句 )字段 NOT IN ( sql语句 )NOT LIKE '%值%'NOT LIKE '%值%'notLikeLeft(boolean condition, String column, Object val) LIKE '%值'notLikeLeft(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) LIKE '%值'notLikeRight(boolean condition, String column, Object val) LIKE '值%'notLikeRight(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) LIKE '值%'or(boolean condition) 拼接 OR排序:ORDER BY 字段, ...final Children排序:ORDER BY 字段, ...排序:ORDER BY 字段, ...orderByAsc(boolean condition, String alias, List<kotlin.reflect.KProperty<?>> columns) orderByDesc(boolean condition, String alias, List<kotlin.reflect.KProperty<?>> columns) orderByStr(boolean condition, boolean isAsc, List<String> columns) 排序:ORDER BY 字段, ...setEntityClass(Class<T> entityClass) setIfExists(BiPredicate<Object, IfExistsSqlKeyWordEnum> IfExists) setIfExists(Predicate<Object> IfExists) setParamAlias(String paramAlias) 参数别名设置,初始化时优先设置该值、重复设置异常<C extends Children>
CtoChildren(Ref<C> children) 转为子类,方便自定义继承扩展<C extends Children>
CtoChildren(Supplier<C> s) 转为子类,方便自定义继承扩展 需要子类自定义字段Methods inherited from class com.baomidou.mybatisplus.core.conditions.Wrapper
getCustomSqlSegment, getSqlSelect, getSqlSet, getTargetSql, isEmptyOfEntity, isEmptyOfNormal, isEmptyOfWhere, isNonEmptyOfEntity, isNonEmptyOfNormal, isNonEmptyOfWhere, nonEmptyOfEntity, nonEmptyOfNormal, nonEmptyOfWhereMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.yulichang.extension.kt.interfaces.Compare
allEq, allEq, between, between, between, eq, eq, eq, ge, ge, ge, gt, gt, gt, le, le, le, like, like, like, likeLeft, likeLeft, likeLeft, likeRight, likeRight, likeRight, lt, lt, lt, ne, ne, ne, notBetween, notBetween, notBetween, notLike, notLike, notLike, notLikeLeft, notLikeLeft, notLikeLeft, notLikeRight, notLikeRight, notLikeRightMethods inherited from interface com.github.yulichang.extension.kt.interfaces.CompareIfExists
eqIfExists, eqIfExists, geIfExists, geIfExists, getIfExists, gtIfExists, gtIfExists, leIfExists, leIfExists, likeIfExists, likeIfExists, likeLeftIfExists, likeLeftIfExists, likeRightIfExists, likeRightIfExists, ltIfExists, ltIfExists, neIfExists, neIfExists, notLikeIfExists, notLikeIfExists, notLikeLeftIfExists, notLikeLeftIfExists, notLikeRightIfExists, notLikeRightIfExistsMethods inherited from interface com.github.yulichang.wrapper.interfaces.CompareStr
allEqStr, allEqStr, allEqStr, allEqStr, between, eq, ge, gt, le, like, likeLeft, likeRight, lt, ne, notBetween, notLike, notLikeLeft, notLikeRightMethods inherited from interface com.github.yulichang.wrapper.interfaces.CompareStrIfExists
eqIfExists, geIfExists, getIfExists, gtIfExists, leIfExists, likeIfExists, likeLeftIfExists, likeRightIfExists, ltIfExists, neIfExists, notLikeIfExists, notLikeLeftIfExists, notLikeRightIfExistsMethods inherited from interface com.github.yulichang.extension.kt.interfaces.Func
func, func, geSql, geSql, geSql, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, gtSql, gtSql, gtSql, having, in, in, in, in, in, in, inSql, inSql, inSql, isNotNull, isNotNull, isNotNull, isNull, isNull, isNull, leSql, leSql, leSql, ltSql, ltSql, ltSql, notIn, notIn, notIn, notIn, notIn, notIn, notInSql, notInSql, notInSql, orderBy, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDescMethods inherited from interface com.github.yulichang.wrapper.interfaces.FuncStr
eqSql, geSql, groupBy, groupBy, groupByStr, gtSql, in, in, inSql, isNotNull, isNull, leSql, ltSql, notIn, notIn, notInSql, orderByAsc, orderByAsc, orderByAsc, orderByAsc, orderByAscStr, orderByAscStr, orderByDesc, orderByDesc, orderByDesc, orderByDesc, orderByDescStr, orderByDescStrMethods inherited from interface com.github.yulichang.wrapper.interfaces.Join
apply, around, comment, exists, first, last, notExists, orMethods inherited from interface com.baomidou.mybatisplus.core.conditions.interfaces.Nested
and, nested, not, or
-
Field Details
-
typedThis
占位符 -
index
表别名 -
paramNameSeq
必要度量 -
paramNameValuePairs
-
paramAlias
protected com.baomidou.mybatisplus.core.conditions.SharedString paramAlias其他 -
lastSql
protected com.baomidou.mybatisplus.core.conditions.SharedString lastSql -
sqlComment
protected com.baomidou.mybatisplus.core.conditions.SharedString sqlCommentSQL注释 -
sqlFirst
protected com.baomidou.mybatisplus.core.conditions.SharedString sqlFirstSQL起始语句 -
onWrappers
ON sql wrapper集合 -
expression
protected com.baomidou.mybatisplus.core.conditions.segments.MergeSegments expression -
joinClass
连表实体类 on 条件 func 使用 -
tableName
连表表名 -
isMain
protected boolean isMain主表wrapper -
isNo
protected boolean isNo是否是OnWrapper -
tableList
关联的表 -
checkSqlInjection
protected boolean checkSqlInjection检查 SQL 注入过滤 -
ifExists
IfExists 策略
-
-
Constructor Details
-
KtAbstractWrapper
public KtAbstractWrapper()
-
-
Method Details
-
getEntity
- Specified by:
getEntityin classcom.baomidou.mybatisplus.core.conditions.Wrapper<T>
-
setEntity
-
getEntityClass
-
setEntityClass
-
toChildren
转为子类,方便自定义继承扩展 -
toChildren
转为子类,方便自定义继承扩展 需要子类自定义字段 -
checkSqlInjection
开启检查 SQL 注入 -
setIfExists
-
setIfExists
-
allEq
public Children allEq(boolean condition, Map<kotlin.reflect.KProperty<?>, ?> params, boolean null2IsNull) Description copied from interface:Comparemap 所有非空属性等于 = -
eq
Description copied from interface:Compare等于 = -
ne
Description copied from interface:Compare不等于 <> -
gt
Description copied from interface:Compare大于 > -
ge
Description copied from interface:Compare大于等于 >= -
lt
Description copied from interface:Compare小于 < -
le
Description copied from interface:Compare小于等于 <= -
like
public Children like(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) Description copied from interface:CompareLIKE '%值%' -
notLike
public Children notLike(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) Description copied from interface:CompareNOT LIKE '%值%' -
likeLeft
public Children likeLeft(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) Description copied from interface:CompareLIKE '%值' -
notLikeLeft
public Children notLikeLeft(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) Description copied from interface:CompareLIKE '%值'- Specified by:
notLikeLeftin interfaceCompare<T>- Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
likeRight
public Children likeRight(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) Description copied from interface:CompareLIKE '值%' -
notLikeRight
public Children notLikeRight(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val) Description copied from interface:CompareLIKE '值%'- Specified by:
notLikeRightin interfaceCompare<T>- Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
between
public Children between(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val1, Object val2) Description copied from interface:CompareBETWEEN 值1 AND 值2 -
notBetween
public Children notBetween(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object val1, Object val2) Description copied from interface:CompareNOT BETWEEN 值1 AND 值2- Specified by:
notBetweenin interfaceCompare<T>- Parameters:
condition- 执行条件column- 字段val1- 值1val2- 值2- Returns:
- children
-
and
- Specified by:
andin interfacecom.baomidou.mybatisplus.core.conditions.interfaces.Nested<T,Children extends KtAbstractWrapper<T, Children>>
-
or
- Specified by:
orin interfacecom.baomidou.mybatisplus.core.conditions.interfaces.Nested<T,Children extends KtAbstractWrapper<T, Children>>
-
nested
- Specified by:
nestedin interfacecom.baomidou.mybatisplus.core.conditions.interfaces.Nested<T,Children extends KtAbstractWrapper<T, Children>>
-
not
- Specified by:
notin interfacecom.baomidou.mybatisplus.core.conditions.interfaces.Nested<T,Children extends KtAbstractWrapper<T, Children>>
-
or
Description copied from interface:Join拼接 OR -
apply
Description copied from interface: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())
-
applyFunc
-
applyFunc
-
last
Description copied from interface:Join无视优化规则直接拼接到 sql 的最后(有sql注入的风险,请谨慎使用)例: last("limit 1")
注意只能调用一次,多次调用以最后一次为准
-
comment
Description copied from interface:Joinsql 注释(会拼接在 sql 的最后面) -
first
Description copied from interface:Joinsql 起始句(会拼接在SQL语句的起始处) -
around
Description copied from interface:Joinsql 起始句 和介绍语句(会拼接在SQL语句的起始处和结束处) -
exists
Description copied from interface:Join拼接 EXISTS ( sql语句 )!! sql 注入方法 !!
例: exists("select id from table where age = 1")
-
notExists
Description copied from interface:Join拼接 NOT EXISTS ( sql语句 )!! sql 注入方法 !!
例: notExists("select id from table where age = 1")
-
isNull
Description copied from interface:Func字段 IS NULL例: isNull("name")
-
isNotNull
Description copied from interface:Func字段 IS NOT NULL例: isNotNull("name")
-
in
public Children in(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Collection<?> coll) Description copied from interface:Func字段 IN (value.get(0), value.get(1), ...)例: in("id", Arrays.asList(1, 2, 3, 4, 5))
- 注意!集合为空若存在逻辑错误,请在 condition 条件中判断
- 如果集合为 empty 则不会进行 sql 拼接
-
in
public Children in(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object... values) Description copied from interface:Func字段 IN (v0, v1, ...)例: in("id", 1, 2, 3, 4, 5)
- 注意!数组为空若存在逻辑错误,请在 condition 条件中判断
- 如果动态数组为 empty 则不会进行 sql 拼接
-
notIn
public Children notIn(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Collection<?> coll) Description copied from interface:Func字段 NOT IN (value.get(0), value.get(1), ...)例: notIn("id", Arrays.asList(1, 2, 3, 4, 5))
-
notIn
public Children notIn(boolean condition, String alias, kotlin.reflect.KProperty<?> column, Object... values) Description copied from interface:Func字段 NOT IN (v0, v1, ...)例: notIn("id", 1, 2, 3, 4, 5)
-
inSql
public Children inSql(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String inValue) Description copied from interface: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
public Children notInSql(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String inValue) Description copied from interface: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")
-
gtSql
public Children gtSql(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String inValue) Description copied from interface:Func字段 > ( sql语句 )例1: gtSql("id", "1, 2, 3, 4, 5, 6")
例1: gtSql("id", "select id from table where name = 'JunJun'")
-
geSql
public Children geSql(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String inValue) Description copied from interface:Func字段 >= ( sql语句 )例1: geSql("id", "1, 2, 3, 4, 5, 6")
例1: geSql("id", "select id from table where name = 'JunJun'")
-
ltSql
public Children ltSql(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String inValue) Description copied from interface:Func字段 < ( sql语句 )例1: ltSql("id", "1, 2, 3, 4, 5, 6")
例1: ltSql("id", "select id from table where name = 'JunJun'")
-
leSql
public Children leSql(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String inValue) Description copied from interface:Func字段 <= ( sql语句 )例1: leSql("id", "1, 2, 3, 4, 5, 6")
例1: leSql("id", "select id from table where name = 'JunJun'")
-
groupBy
-
groupBy
Description copied from interface:Func分组:GROUP BY 字段, ...例: groupBy("id", "name")
-
orderByAsc
public Children orderByAsc(boolean condition, String alias, List<kotlin.reflect.KProperty<?>> columns) - Specified by:
orderByAscin interfaceFunc<T>
-
orderByDesc
public Children orderByDesc(boolean condition, String alias, List<kotlin.reflect.KProperty<?>> columns) - Specified by:
orderByDescin interfaceFunc<T>
-
orderBy
public Children orderBy(boolean condition, boolean isAsc, String alias, kotlin.reflect.KProperty<?>... columns) Description copied from interface:Func排序:ORDER BY 字段, ...例: orderBy(true, "id", "name")
-
columnSqlInjectFilter
protected kotlin.reflect.KProperty<?> columnSqlInjectFilter(kotlin.reflect.KProperty<?> column) 字段 SQL 注入过滤处理,子类重写实现过滤逻辑- Parameters:
column- 字段内容- Returns:
- Children
-
having
Description copied from interface:FuncHAVING ( sql语句 )例1: having("sum(age) > 10")
例2: having("sum(age) > {0}", 10)
-
func
-
not
内部自用NOT 关键词
-
and
内部自用拼接 AND
-
likeValue
protected Children likeValue(boolean condition, com.baomidou.mybatisplus.core.enums.SqlKeyword keyword, String alias, kotlin.reflect.KProperty<?> column, Object val, com.baomidou.mybatisplus.core.enums.SqlLike sqlLike) 内部自用拼接 LIKE 以及 值
-
likeValue
-
addCondition
protected Children addCondition(boolean condition, String alias, kotlin.reflect.KProperty<?> column, com.baomidou.mybatisplus.core.enums.SqlKeyword sqlKeyword, Object val) 普通查询条件- Parameters:
condition- 是否执行column- 属性sqlKeyword- SQL 关键词val- 条件值
-
addCondition
-
addCondition
-
addNestedCondition
多重嵌套查询条件- Parameters:
condition- 查询条件值
-
instance
子类返回一个自己的新对象 -
instanceEmpty
-
instance
-
formatSqlMaybeWithParam
格式化 sql支持 "{0}" 这种,或者 "sql {0} sql" 这种
- Parameters:
sqlStr- 可能是sql片段params- 参数- Returns:
- sql片段
-
formatParam
处理入参- Parameters:
mapping- 例如: "javaType=int,jdbcType=NUMERIC,typeHandler=xxx.xxx.MyTypeHandler" 这种param- 参数- Returns:
- value
-
maybeDo
函数化的做事- Parameters:
condition- 做不做something- 做什么- Returns:
- Children
-
inExpression
获取in表达式 包含括号- Parameters:
value- 集合
-
inExpression
获取in表达式 包含括号- Parameters:
values- 数组
-
clear
public void clear()- Specified by:
clearin classcom.baomidou.mybatisplus.core.conditions.Wrapper<T>
-
appendSqlSegments
protected void appendSqlSegments(com.baomidou.mybatisplus.core.conditions.ISqlSegment... sqlSegments) 添加 where 片段- Parameters:
sqlSegments- ISqlSegment 数组
-
getSqlSegment
- Specified by:
getSqlSegmentin interfacecom.baomidou.mybatisplus.core.conditions.ISqlSegment
-
getSqlComment
- Overrides:
getSqlCommentin classcom.baomidou.mybatisplus.core.conditions.Wrapper<T>
-
getSqlFirst
- Overrides:
getSqlFirstin classcom.baomidou.mybatisplus.core.conditions.Wrapper<T>
-
getExpression
public com.baomidou.mybatisplus.core.conditions.segments.MergeSegments getExpression()- Specified by:
getExpressionin classcom.baomidou.mybatisplus.core.conditions.Wrapper<T>
-
getParamAlias
-
setParamAlias
参数别名设置,初始化时优先设置该值、重复设置异常- Parameters:
paramAlias- 参数别名- Returns:
- Children
-
columnToSqlSegment
protected final com.baomidou.mybatisplus.core.conditions.ISqlSegment columnToSqlSegment(Integer index, String alias, kotlin.reflect.KProperty<?> column) 获取 columnName -
columnToSqlSegmentS
-
columnToSqlSegment
protected final com.baomidou.mybatisplus.core.conditions.ISqlSegment columnToSqlSegment(String column) -
columnToString
-
columnsToString
-
columnsToString
-
columnsToString
protected String columnsToString(Integer index, PrefixEnum prefixEnum, String alias, kotlin.reflect.KProperty<?>... columns) 多字段转换为逗号 "," 分割字符串- Parameters:
columns- 多字段
-
columnsToString
protected String columnsToString(Integer index, PrefixEnum prefixEnum, String alias, List<kotlin.reflect.KProperty<?>> columns) -
clone
-
eq
public Children eq(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) Description copied from interface:OnCompare等于 = -
ne
public Children ne(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) Description copied from interface:OnCompare不等于 <> -
gt
public Children gt(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) Description copied from interface:OnCompare大于 > -
ge
public Children ge(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) Description copied from interface:OnCompare大于等于 >= -
lt
public Children lt(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) Description copied from interface:OnCompare小于 < -
le
public Children le(boolean condition, String alias, kotlin.reflect.KProperty<?> column, String rightAlias, kotlin.reflect.KProperty<?> val) Description copied from interface:OnCompare小于等于 <= -
allEqStr
Description copied from interface:CompareStrmap 所有非空属性等于 =- Specified by:
allEqStrin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件params- map 类型的参数, key 是字段名, value 是字段值null2IsNull- 是否参数为 null 自动执行 isNull 方法, false 则忽略这个字段\- Returns:
- children
-
allEqStr
public <V> Children allEqStr(boolean condition, BiPredicate<String, V> filter, Map<String, V> params, boolean null2IsNull) Description copied from interface:CompareStr字段过滤接口,传入多参数时允许对参数进行过滤- Specified by:
allEqStrin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件filter- 返回 true 来允许字段传入比对条件中params- map 类型的参数, key 是字段名, value 是字段值null2IsNull- 是否参数为 null 自动执行 isNull 方法, false 则忽略这个字段- Returns:
- children
-
eq
Description copied from interface:CompareStr等于 =- Specified by:
eqin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
ne
Description copied from interface:CompareStr不等于 <>- Specified by:
nein interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
gt
Description copied from interface:CompareStr大于 >- Specified by:
gtin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
ge
Description copied from interface:CompareStr大于等于 >=- Specified by:
gein interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
lt
Description copied from interface:CompareStr小于 <- Specified by:
ltin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
le
Description copied from interface:CompareStr小于等于 <=- Specified by:
lein interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
like
Description copied from interface:CompareStrLIKE '%值%'- Specified by:
likein interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
notLike
Description copied from interface:CompareStrNOT LIKE '%值%'- Specified by:
notLikein interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
likeLeft
Description copied from interface:CompareStrLIKE '%值'- Specified by:
likeLeftin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
notLikeLeft
Description copied from interface:CompareStrLIKE '%值'- Specified by:
notLikeLeftin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
likeRight
Description copied from interface:CompareStrLIKE '值%'- Specified by:
likeRightin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
notLikeRight
Description copied from interface:CompareStrLIKE '值%'- Specified by:
notLikeRightin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val- 值- Returns:
- children
-
between
Description copied from interface:CompareStrBETWEEN 值1 AND 值2- Specified by:
betweenin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val1- 值1val2- 值2- Returns:
- children
-
notBetween
Description copied from interface:CompareStrNOT BETWEEN 值1 AND 值2- Specified by:
notBetweenin interfaceCompareStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件column- 字段val1- 值1val2- 值2- Returns:
- children
-
isNull
Description copied from interface:FuncStr字段 IS NULL例: isNull("name")
-
isNotNull
Description copied from interface:FuncStr字段 IS NOT NULL例: isNotNull("name")
-
in
Description copied from interface:FuncStr字段 IN (value.get(0), value.get(1), ...)例: in("id", Arrays.asList(1, 2, 3, 4, 5))
- 注意!集合为空若存在逻辑错误,请在 condition 条件中判断
- 如果集合为 empty 则不会进行 sql 拼接
-
in
Description copied from interface:FuncStr字段 IN (v0, v1, ...)例: in("id", 1, 2, 3, 4, 5)
- 注意!数组为空若存在逻辑错误,请在 condition 条件中判断
- 如果动态数组为 empty 则不会进行 sql 拼接
-
notIn
Description copied from interface:FuncStr字段 NOT IN (value.get(0), value.get(1), ...)例: notIn("id", Arrays.asList(1, 2, 3, 4, 5))
-
notIn
Description copied from interface:FuncStr字段 NOT IN (v0, v1, ...)例: notIn("id", 1, 2, 3, 4, 5)
-
inSql
Description copied from interface:FuncStr字段 IN ( sql语句 )!! sql 注入方式的 in 方法 !!
例1: inSql("id", "1, 2, 3, 4, 5, 6")
例2: inSql("id", "select id from table where id < 3")
-
gtSql
Description copied from interface:FuncStr字段 > ( sql语句 )例1: gtSql("id", "1, 2, 3, 4, 5, 6")
例1: gtSql("id", "select id from table where name = 'JunJun'")
-
geSql
Description copied from interface:FuncStr字段 >= ( sql语句 )例1: geSql("id", "1, 2, 3, 4, 5, 6")
例1: geSql("id", "select id from table where name = 'JunJun'")
-
ltSql
Description copied from interface:FuncStr字段 < ( sql语句 )例1: ltSql("id", "1, 2, 3, 4, 5, 6")
例1: ltSql("id", "select id from table where name = 'JunJun'")
-
leSql
Description copied from interface:FuncStr字段 <= ( sql语句 )例1: leSql("id", "1, 2, 3, 4, 5, 6")
例1: leSql("id", "select id from table where name = 'JunJun'")
-
eqSql
Description copied from interface:FuncStr字段 = ( sql语句 )例1: eqSql("id", "1, 2, 3, 4, 5, 6")
例1: eqSql("id", "select id from table where name = 'JunJun'")
-
notInSql
Description copied from interface:FuncStr字段 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
Description copied from interface:FuncStr分组:GROUP BY 字段, ... -
orderBy
Description copied from interface:FuncStr排序:ORDER BY 字段, ... -
groupBy
Description copied from interface:FuncStr分组:GROUP BY 字段, ...例: groupBy("id")
-
groupByStr
Description copied from interface:FuncStr分组:GROUP BY 字段, ...例: groupBy(Arrays.asList("id", "name"))
- Specified by:
groupByStrin interfaceFuncStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件columns- 字段数组- Returns:
- children
-
orderBy
Description copied from interface:FuncStr排序:ORDER BY 字段, ...例: orderBy(true, "id")
-
orderByStr
Description copied from interface:FuncStr排序:ORDER BY 字段, ...例: orderBy(true, Arrays.asList("id", "name"))
- Specified by:
orderByStrin interfaceFuncStr<T,Children extends KtAbstractWrapper<T, Children>> - Parameters:
condition- 执行条件isAsc- 是否是 ASC 排序columns- 字段列表- Returns:
- children
-