lyf666 2017-02-17 15:00:19 +08:00
parent 0d24781dfc
commit 6ab0d64546
1 changed files with 10 additions and 2 deletions

View File

@ -70,7 +70,15 @@ public class Controller extends com.jfinal.core.Controller{
Map<String, String[]> paraMap = getParaMap(); Map<String, String[]> paraMap = getParaMap();
Document dict = new Document(); Document dict = new Document();
paraMap.forEach((key, arr) -> { paraMap.forEach((key, arr) -> {
if (arr.length == 1) {
dict.put(key, arr[0]); dict.put(key, arr[0]);
} else if (arr.length > 1) {
List<String> s = new ArrayList<>();
for (String s1 : arr) {
s.add(s1);
}
dict.put(key, s);
}
}); });
getCollection().insertOne(dict); getCollection().insertOne(dict);
renderJson(dict.toJson()); renderJson(dict.toJson());