|
@@ -20,7 +20,8 @@ import com.baomidou.mybatisplus.toolkit.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.toolkit.StringUtils;
|
|
|
|
|
|
import java.text.MessageFormat;
|
|
|
-import java.util.List;
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.Iterator;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -126,7 +127,7 @@ public class TSqlPlus extends MybatisAbstractSQL<TSqlPlus> {
|
|
|
* List集合
|
|
|
* @return
|
|
|
*/
|
|
|
- public TSqlPlus IN(String column, List<?> value) {
|
|
|
+ public TSqlPlus IN(String column, Collection<?> value) {
|
|
|
handerIn(column, value, false);
|
|
|
return this;
|
|
|
}
|
|
@@ -140,7 +141,7 @@ public class TSqlPlus extends MybatisAbstractSQL<TSqlPlus> {
|
|
|
* List集合
|
|
|
* @return
|
|
|
*/
|
|
|
- public TSqlPlus NOT_IN(String column, List<?> value) {
|
|
|
+ public TSqlPlus NOT_IN(String column, Collection<?> value) {
|
|
|
handerIn(column, value, true);
|
|
|
return this;
|
|
|
}
|
|
@@ -223,7 +224,7 @@ public class TSqlPlus extends MybatisAbstractSQL<TSqlPlus> {
|
|
|
* @param isNot
|
|
|
* 是否为NOT IN操作
|
|
|
*/
|
|
|
- private void handerIn(String column, List<?> value, boolean isNot) {
|
|
|
+ private void handerIn(String column, Collection<?> value, boolean isNot) {
|
|
|
if (StringUtils.isNotEmpty(column) && CollectionUtil.isNotEmpty(value)) {
|
|
|
StringBuilder inSql = new StringBuilder();
|
|
|
inSql.append(column);
|
|
@@ -232,14 +233,17 @@ public class TSqlPlus extends MybatisAbstractSQL<TSqlPlus> {
|
|
|
}
|
|
|
inSql.append(" IN (");
|
|
|
int _size = value.size();
|
|
|
- for (int i = 0; i < _size; i++) {
|
|
|
- String tempVal = StringUtils.quotaMark(value.get(i));
|
|
|
+ int i = 0;
|
|
|
+ Iterator<?> iterator = value.iterator();
|
|
|
+ while(iterator.hasNext()) {
|
|
|
+ String tempVal = StringUtils.quotaMark(iterator.next());
|
|
|
if (i + 1 == _size) {
|
|
|
inSql.append(tempVal);
|
|
|
} else {
|
|
|
inSql.append(tempVal);
|
|
|
inSql.append(",");
|
|
|
}
|
|
|
+ i++;
|
|
|
}
|
|
|
inSql.append(")");
|
|
|
WHERE(inSql.toString());
|