Commit 67cd11ad by tc

feature:[none] 优化公共方法

parent f575b55b
...@@ -6,6 +6,7 @@ package com.pcloud.common.utils; ...@@ -6,6 +6,7 @@ package com.pcloud.common.utils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
/** /**
...@@ -69,6 +70,9 @@ public class ListUtils { ...@@ -69,6 +70,9 @@ public class ListUtils {
} }
public static <T> List<T>groupList4SQL(ListForInSQL<T> listForInSQL,List<Long>idList){ public static <T> List<T>groupList4SQL(ListForInSQL<T> listForInSQL,List<Long>idList){
HashSet<Long>idSet = new HashSet<>(idList);
idList.clear();
idList.addAll(idSet);
List<T>result = new ArrayList<>(); List<T>result = new ArrayList<>();
if(idList!=null && idList.size()>500){ if(idList!=null && idList.size()>500){
List<List<Long>> lists = groupList(idList); List<List<Long>> lists = groupList(idList);
...@@ -77,8 +81,10 @@ public class ListUtils { ...@@ -77,8 +81,10 @@ public class ListUtils {
result.addAll(tempList); result.addAll(tempList);
} }
return result; return result;
}else{ }else if(idList != null && idList.size()>0){
return listForInSQL.processSQL(idList); return listForInSQL.processSQL(idList);
}else{
return new ArrayList<>();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment