|
@@ -15,6 +15,10 @@
|
|
*/
|
|
*/
|
|
package com.baomidou.mybatisplus.core.conditions.query;
|
|
package com.baomidou.mybatisplus.core.conditions.query;
|
|
|
|
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
+import java.util.function.Predicate;
|
|
|
|
+
|
|
import com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.SharedString;
|
|
import com.baomidou.mybatisplus.core.conditions.SharedString;
|
|
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
|
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
|
@@ -23,10 +27,6 @@ import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.TableInfoHelper;
|
|
import com.baomidou.mybatisplus.core.toolkit.TableInfoHelper;
|
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
-import java.util.function.Predicate;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* Lambda 语法使用 Wrapper
|
|
* Lambda 语法使用 Wrapper
|
|
@@ -40,19 +40,36 @@ public class LambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, LambdaQueryW
|
|
implements Query<LambdaQueryWrapper<T>, T, SFunction<T, ?>> {
|
|
implements Query<LambdaQueryWrapper<T>, T, SFunction<T, ?>> {
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * <p>
|
|
* 查询字段
|
|
* 查询字段
|
|
|
|
+ * </p>
|
|
*/
|
|
*/
|
|
private SharedString sqlSelect = new SharedString();
|
|
private SharedString sqlSelect = new SharedString();
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * <p>
|
|
|
|
+ * 不建议直接 new 该实例,使用 Wrappers.lambdaQuery(entity)
|
|
|
|
+ * </p>
|
|
|
|
+ */
|
|
public LambdaQueryWrapper() {
|
|
public LambdaQueryWrapper() {
|
|
this(null);
|
|
this(null);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * <p>
|
|
|
|
+ * 不建议直接 new 该实例,使用 Wrappers.lambdaQuery(entity)
|
|
|
|
+ * </p>
|
|
|
|
+ */
|
|
public LambdaQueryWrapper(T entity) {
|
|
public LambdaQueryWrapper(T entity) {
|
|
super.setEntity(entity);
|
|
super.setEntity(entity);
|
|
super.initNeed();
|
|
super.initNeed();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * <p>
|
|
|
|
+ * 不建议直接 new 该实例,使用 Wrappers.lambdaQuery(...)
|
|
|
|
+ * </p>
|
|
|
|
+ */
|
|
LambdaQueryWrapper(T entity, Class<T> entityClass, SharedString sqlSelect, AtomicInteger paramNameSeq,
|
|
LambdaQueryWrapper(T entity, Class<T> entityClass, SharedString sqlSelect, AtomicInteger paramNameSeq,
|
|
Map<String, Object> paramNameValuePairs, MergeSegments mergeSegments) {
|
|
Map<String, Object> paramNameValuePairs, MergeSegments mergeSegments) {
|
|
super.setEntity(entity);
|
|
super.setEntity(entity);
|
|
@@ -89,11 +106,11 @@ public class LambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, LambdaQueryW
|
|
* 过滤查询的字段信息(主键除外!)
|
|
* 过滤查询的字段信息(主键除外!)
|
|
* </p>
|
|
* </p>
|
|
* <p>
|
|
* <p>
|
|
- * 例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)
|
|
|
|
|
|
+ * 例1: 只要 java 字段名以 "test" 开头的 -> select(i -> i.getProperty().startsWith("test")) <br/>
|
|
|
|
+ * 例2: 只要 java 字段属性是 CharSequence 类型的 -> select(TableFieldInfo::isCharSequence) <br/>
|
|
|
|
+ * 例3: 只要 java 字段没有填充策略的 -> select(i -> i.getFieldFill() == FieldFill.DEFAULT) <br/>
|
|
|
|
+ * 例4: 要全部字段 -> select(i -> true) <br/>
|
|
|
|
+ * 例5: 只要主键字段 -> select(i -> false) <br/>
|
|
* </p>
|
|
* </p>
|
|
*
|
|
*
|
|
* @param predicate 过滤方式
|
|
* @param predicate 过滤方式
|
|
@@ -113,7 +130,7 @@ public class LambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, LambdaQueryW
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
- * 用于生成嵌套 sql
|
|
|
|
|
|
+ * 用于生成嵌套 sql <br/>
|
|
* 故 sqlSelect 不向下传递
|
|
* 故 sqlSelect 不向下传递
|
|
* </p>
|
|
* </p>
|
|
*/
|
|
*/
|