public class MPJLambdaWrapper<T> extends MPJAbstractLambdaWrapper<T,MPJLambdaWrapper<T>> implements Query<MPJLambdaWrapper<T>>, LambdaJoin<MPJLambdaWrapper<T>>
LambdaQueryWrapper
Lambda 语法使用 Wrapper
推荐使用 Wrappers.
MPJAbstractWrapper.DoSomethingcolumnMapentityClass, expression, hasAlias, lastSql, paramAlias, paramNameSeq, paramNameValuePairs, sqlComment, sqlFirst, typedThis| 构造器和说明 |
|---|
MPJLambdaWrapper()
不建议直接 new 该实例,使用 Wrappers.lambdaQuery()
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear() |
boolean |
getAutoAlias() |
String |
getFrom()
获取连表部分语句
|
String |
getSqlSelect()
查询条件 SQL 片段
|
protected MPJLambdaWrapper<T> |
instance()
子类返回一个自己的新对象
|
protected MPJLambdaWrapper<T> |
instance(boolean hasAlias,
Class<?> entityClass) |
<R> MPJLambdaWrapper<T> |
join(String keyWord,
boolean condition,
Class<R> clazz,
OnFunction function)
查询基类 可以直接调用此方法实现以上所有功能
|
<E> MPJLambdaWrapper<T> |
select(Class<E> entityClass,
Predicate<com.baomidou.mybatisplus.core.metadata.TableFieldInfo> predicate)
过滤查询的字段信息(主键除外!)
|
<S> MPJLambdaWrapper<T> |
select(com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?>... columns)
设置查询字段
|
MPJLambdaWrapper<T> |
selectAll(Class<?> clazz)
查询实体类全部字段
|
<S> MPJLambdaWrapper<T> |
selectAs(com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?> column,
String alias)
别名查询
|
MPJLambdaWrapper<T> |
selectFunc(boolean condition,
BaseFuncEnum funcEnum,
Object column,
String alias)
聚合函数查询
|
<S> MPJLambdaWrapper<T> |
selectFunc(boolean condition,
BaseFuncEnum funcEnum,
com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?> column,
String alias) |
<S> MPJLambdaWrapper<T> |
selectIgnore(com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?>... columns)
忽略查询字段
用法: selectIgnore(UserDO::getId,UserDO::getSex)
注意: 一个selectIgnore只支持一个对象 如果要忽略多个实体的字段,请调用多次
.selectIgnore(UserDO::getId,UserDO::getSex)
.selectIgnore(UserAddressDO::getArea,UserAddressDO::getCity)
|
MPJLambdaWrapper<T> |
selectQuery(Class<?> clazz,
OnFunction function,
String alias)
子查询
|
columnsToString, columnToString, columnToString, columnToString, getCacheaddCondition, addCondition, addNestedCondition, allEq, allEq, and, and, appendSqlSegments, apply, between, clone, columnSqlInjectFilter, columnToSqlSegment, columnToSqlSegment, comment, eq, eq, exists, first, formatParam, formatSqlMaybeWithParam, func, ge, ge, getEntity, getExpression, getParamAlias, getParamNameValuePairs, getSqlComment, getSqlFirst, getSqlSegment, groupBy, gt, gt, having, in, in, inExpression, inExpression, initNeed, inSql, isNotNull, isNull, last, le, le, like, likeLeft, likeRight, likeValue, lt, lt, maybeDo, ne, ne, nested, not, not, notBetween, notExists, notIn, notIn, notInSql, notLike, or, or, orderBy, setParamAliasgetCustomSqlSegment, getSqlSet, getTargetSql, isEmptyOfEntity, isEmptyOfNormal, isEmptyOfWhere, nonEmptyOfEntity, nonEmptyOfNormal, nonEmptyOfWhereequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitselectAs, selectAvg, selectAvg, selectAvg, selectAvg, selectAvg, selectAvg, selectCount, selectCount, selectCount, selectCount, selectCount, selectCount, selectCount, selectCount, selectCount, selectCount, selectFunc, selectFunc, selectFunc, selectFunc, selectFunc, selectFunc, selectFunc, selectFunc, selectLen, selectLen, selectLen, selectLen, selectLen, selectLen, selectMax, selectMax, selectMax, selectMax, selectMax, selectMax, selectMin, selectMin, selectMin, selectMin, selectMin, selectMin, selectQuery, selectSum, selectSum, selectSum, selectSum, selectSum, selectSuminnerJoin, innerJoin, innerJoin, innerJoin, leftJoin, leftJoin, leftJoin, leftJoin, rightJoin, rightJoin, rightJoin, rightJoinallEq, allEq, allEq, allEq, between, eq, ge, gt, le, like, likeLeft, likeRight, lt, ne, notBetween, notLikeapply, comment, exists, first, last, notExists, orfunc, groupBy, having, in, in, inSql, isNotNull, isNull, notIn, notIn, notInSql, orderByAsc, orderByAsc, orderByDesc, orderByDescprotected MPJLambdaWrapper<T> instance()
MPJAbstractWrapperinstance 在类中 MPJAbstractWrapper<T,MPJLambdaWrapper<T>>protected MPJLambdaWrapper<T> instance(boolean hasAlias, Class<?> entityClass)
@SafeVarargs public final <S> MPJLambdaWrapper<T> select(com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?>... columns)
Queryselect 在接口中 Query<MPJLambdaWrapper<T>>columns - 字段数组public <E> MPJLambdaWrapper<T> select(Class<E> entityClass, Predicate<com.baomidou.mybatisplus.core.metadata.TableFieldInfo> predicate)
Query例1: 只要 java 字段名以 "test" 开头的 -> select(i -> i.getProperty().startsWith("test"))
例2: 只要 java 字段属性是 CharSequence 类型的 -> select(TableFieldInfo::isCharSequence)
例3: 只要 java 字段没有填充策略的 -> select(i -> i.getFieldFill() == FieldFill.DEFAULT)
例4: 要全部字段 -> select(i -> true)
例5: 只要主键字段 -> select(i -> false)
select 在接口中 Query<MPJLambdaWrapper<T>>predicate - 过滤方式public <S> MPJLambdaWrapper<T> selectAs(com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?> column, String alias)
QueryselectAs 在接口中 Query<MPJLambdaWrapper<T>>public <S> MPJLambdaWrapper<T> selectFunc(boolean condition, BaseFuncEnum funcEnum, com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?> column, String alias)
selectFunc 在接口中 Query<MPJLambdaWrapper<T>>public MPJLambdaWrapper<T> selectFunc(boolean condition, BaseFuncEnum funcEnum, Object column, String alias)
QueryselectFunc 在接口中 Query<MPJLambdaWrapper<T>>funcEnum - 函数枚举 DefaultFuncEnumcolumn - 函数作用的字段alias - 别名public final MPJLambdaWrapper<T> selectAll(Class<?> clazz)
QueryselectAll 在接口中 Query<MPJLambdaWrapper<T>>@SafeVarargs public final <S> MPJLambdaWrapper<T> selectIgnore(com.baomidou.mybatisplus.core.toolkit.support.SFunction<S,?>... columns)
Query用法: selectIgnore(UserDO::getId,UserDO::getSex) 注意: 一个selectIgnore只支持一个对象 如果要忽略多个实体的字段,请调用多次
.selectIgnore(UserDO::getId,UserDO::getSex) .selectIgnore(UserAddressDO::getArea,UserAddressDO::getCity)
selectIgnore 在接口中 Query<MPJLambdaWrapper<T>>public MPJLambdaWrapper<T> selectQuery(Class<?> clazz, OnFunction function, String alias)
QueryselectQuery 在接口中 Query<MPJLambdaWrapper<T>>clazz - 查询的类function - 查询lambdaalias - 别名public String getSqlSelect()
getSqlSelect 在接口中 Query<MPJLambdaWrapper<T>>getSqlSelect 在类中 com.baomidou.mybatisplus.core.conditions.Wrapper<T>public String getFrom()
public boolean getAutoAlias()
public void clear()
clear 在类中 MPJAbstractWrapper<T,MPJLambdaWrapper<T>>public <R> MPJLambdaWrapper<T> join(String keyWord, boolean condition, Class<R> clazz, OnFunction function)
LambdaJoinjoin 在接口中 LambdaJoin<MPJLambdaWrapper<T>>keyWord - 连表关键字condition - 是否执行clazz - 连表实体类function - 关联条件Copyright © 2021. All rights reserved.