[Improvement] Fix inefficient map iterator (#6004)
* Fix inefficient map iterator * Use forEach and remove call to valueOf * Modify AbstractParameters
This commit is contained in:
parent
e866d1be86
commit
ca93b8a40c
|
|
@ -30,6 +30,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
|
||||
|
|
@ -152,7 +153,7 @@ public abstract class AbstractParameters implements IParameters {
|
|||
ArrayNode paramsByJson = JSONUtils.parseArray(json);
|
||||
Iterator<JsonNode> listIterator = paramsByJson.iterator();
|
||||
while (listIterator.hasNext()) {
|
||||
Map<String, String> param = JSONUtils.toMap(listIterator.next().toString(), String.class, String.class);
|
||||
Map<String, String> param = JSONUtils.parseObject(listIterator.next().toString(), new TypeReference<Map<String, String>>() {});
|
||||
allParams.add(param);
|
||||
}
|
||||
return allParams;
|
||||
|
|
|
|||
|
|
@ -251,9 +251,9 @@ public class SqlParameters extends AbstractParameters {
|
|||
sqlResultFormat.put(key, new ArrayList<>());
|
||||
}
|
||||
for (Map<String, String> info : sqlResult) {
|
||||
for (String key : info.keySet()) {
|
||||
sqlResultFormat.get(key).add(String.valueOf(info.get(key)));
|
||||
}
|
||||
info.forEach((key, value) -> {
|
||||
sqlResultFormat.get(key).add(value);
|
||||
});
|
||||
}
|
||||
for (Property info : outProperty) {
|
||||
if (info.getType() == DataType.LIST) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue