|
@@ -1,8 +1,13 @@
|
|
|
package com.baomidou.mybatisplus.core.toolkit;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.EmptyWrapper;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.ISqlSegment;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
@@ -14,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
* @author Caratacus
|
|
|
*/
|
|
|
public final class Wrappers {
|
|
|
+
|
|
|
/**
|
|
|
* 空的 EmptyWrapper
|
|
|
*/
|
|
@@ -112,9 +118,114 @@ public final class Wrappers {
|
|
|
*
|
|
|
* @param <T> 任意泛型
|
|
|
* @return EmptyWrapper<T>
|
|
|
+ * @see EmptyWrapper
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public static <T> QueryWrapper<T> emptyWrapper() {
|
|
|
return (QueryWrapper<T>) emptyWrapper;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一个空的QueryWrapper子类该类不包含任何条件
|
|
|
+ *
|
|
|
+ * @param <T>
|
|
|
+ * @see com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
|
|
|
+ */
|
|
|
+ private static class EmptyWrapper<T> extends QueryWrapper<T> {
|
|
|
+
|
|
|
+ private static final long serialVersionUID = -2515957613998092272L;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public T getEntity() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public EmptyWrapper<T> setEntity(T entity) {
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getSqlSelect() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getSqlSet() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public MergeSegments getExpression() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean isEmptyOfWhere() {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean isEmptyOfNormal() {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean nonEmptyOfEntity() {
|
|
|
+ return !isEmptyOfEntity();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean isEmptyOfEntity() {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void initEntityClass() {
|
|
|
+ }
|
|
|
+
|
|
|
+ protected Class<T> getCheckEntityClass() {
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public EmptyWrapper<T> last(boolean condition, String lastSql) {
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected EmptyWrapper<T> doIt(boolean condition, ISqlSegment... sqlSegments) {
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("EmptyMethod")
|
|
|
+ @Override
|
|
|
+ public String getParamAlias() {
|
|
|
+ return super.getParamAlias();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getSqlSegment() {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getParamNameValuePairs() {
|
|
|
+ return Collections.emptyMap();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected String columnsToString(String... columns) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected String columnToString(String column) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected EmptyWrapper<T> instance(AtomicInteger paramNameSeq, Map<String, Object> paramNameValuePairs) {
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|