|
@@ -22,9 +22,10 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
|
|
|
super.initNeed();
|
|
|
}
|
|
|
|
|
|
- private Where(Sql<T> sql, T entity, Class<T> entityClass, AtomicInteger paramNameSeq,
|
|
|
- Map<String, Object> paramNameValuePairs, MergeSegments mergeSegments, SharedString paramAlias,
|
|
|
- SharedString lastSql, SharedString sqlComment, SharedString sqlFirst) {
|
|
|
+ protected Where(Sql<T> sql, T entity, Class<T> entityClass, AtomicInteger paramNameSeq,
|
|
|
+ Map<String, Object> paramNameValuePairs, MergeSegments mergeSegments, SharedString paramAlias,
|
|
|
+ SharedString lastSql, SharedString sqlComment, SharedString sqlFirst) {
|
|
|
+ this.sql = sql;
|
|
|
super.setEntity(entity);
|
|
|
super.setEntityClass(entityClass);
|
|
|
this.paramNameSeq = paramNameSeq;
|
|
@@ -34,7 +35,12 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
|
|
|
this.lastSql = lastSql;
|
|
|
this.sqlComment = sqlComment;
|
|
|
this.sqlFirst = sqlFirst;
|
|
|
- this.sql = sql;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected Where<T> instance() {
|
|
|
+ return new Where<>(sql, getEntity(), getEntityClass(), paramNameSeq, paramNameValuePairs, new MergeSegments(),
|
|
|
+ paramAlias, SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -232,10 +238,6 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
|
|
|
return in(sql.getSqlFieldName(alias, function), value);
|
|
|
}
|
|
|
|
|
|
- public Where<T> in(String sqlFieldName, Collection<?> value) {
|
|
|
- return in(ObjectUtil.isNotEmpty(value), sqlFieldName, value);
|
|
|
- }
|
|
|
-
|
|
|
public <K, V> Where<T> in(SFunction<K, V> function, Object... value) {
|
|
|
return in(sql.getSqlFieldName(function), value);
|
|
|
}
|
|
@@ -244,6 +246,14 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
|
|
|
return in(sql.getSqlFieldName(alias, function), value);
|
|
|
}
|
|
|
|
|
|
+ public Where<T> in(String sqlFieldName, Collection<?> value) {
|
|
|
+ return in(ObjectUtil.isNotEmpty(value), sqlFieldName, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Where<T> in(String sqlFieldName, Object... value) {
|
|
|
+ return in(ObjectUtil.isNotEmpty(value), sqlFieldName, value);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* notIn
|
|
|
*/
|
|
@@ -255,10 +265,6 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
|
|
|
return notIn(sql.getSqlFieldName(alias, function), value);
|
|
|
}
|
|
|
|
|
|
- public Where<T> notIn(String sqlFieldName, Collection<?> value) {
|
|
|
- return notIn(ObjectUtil.isNotEmpty(value), sqlFieldName, value);
|
|
|
- }
|
|
|
-
|
|
|
public <K, V> Where<T> notIn(SFunction<K, V> function, Object... value) {
|
|
|
return notIn(sql.getSqlFieldName(function), value);
|
|
|
}
|
|
@@ -267,21 +273,24 @@ public class Where<T> extends AbstractWrapper<T, String, Where<T>> {
|
|
|
return notIn(sql.getSqlFieldName(alias, function), value);
|
|
|
}
|
|
|
|
|
|
+ public Where<T> notIn(String sqlFieldName, Collection<?> value) {
|
|
|
+ return notIn(ObjectUtil.isNotEmpty(value), sqlFieldName, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Where<T> notIn(String sqlFieldName, Object... value) {
|
|
|
+ return notIn(ObjectUtil.isNotEmpty(value), sqlFieldName, value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* findInSet
|
|
|
*/
|
|
|
public <K, V> Where<T> findInSet(SFunction<K, V> function, Object value) {
|
|
|
- return apply(ObjectUtil.isNotEmpty(value), "find_in_set({0}, " + sql.getSqlFieldName(function) + ")", value);
|
|
|
+ return apply(ObjectUtil.isNotEmpty(value), "FIND_IN_SET({0}, " + sql.getSqlFieldName(function) + ")", value);
|
|
|
}
|
|
|
|
|
|
public <K, V> Where<T> findInSet(String alias, SFunction<K, V> function, Object value) {
|
|
|
- return apply(ObjectUtil.isNotEmpty(value), "find_in_set({0}, " + sql.getSqlFieldName(alias, function) + ")", value);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- protected Where<T> instance() {
|
|
|
- return new Where<>(sql, getEntity(), getEntityClass(), paramNameSeq, paramNameValuePairs, new MergeSegments(),
|
|
|
- paramAlias, SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString());
|
|
|
+ return apply(ObjectUtil.isNotEmpty(value), "FIND_IN_SET({0}, " + sql.getSqlFieldName(alias, function) + ")", value);
|
|
|
}
|
|
|
|
|
|
public List<T> list() {
|