diff --git a/src/main/java/com/lq/code/util/sql/SqlUtil.java b/src/main/java/com/lq/code/util/sql/SqlUtil.java index 71ec3e6..7bc237a 100755 --- a/src/main/java/com/lq/code/util/sql/SqlUtil.java +++ b/src/main/java/com/lq/code/util/sql/SqlUtil.java @@ -73,9 +73,10 @@ public class SqlUtil { * @return */ public static Map getAttributeAndColumn(Class entityClazz){ - Map map=new HashMap<>(); + List fieldsList=BeanUtil.getAllField(entityClazz); Iterator iterator = fieldsList.iterator(); + Map map=new HashMap<>(fieldsList.size()); while (iterator.hasNext()){ Field field = (Field) iterator.next(); map.put(field.getName(),caseToHump(field.getName())); diff --git a/src/main/java/com/lq/wechat/util/MessageUtil.java b/src/main/java/com/lq/wechat/util/MessageUtil.java index 4cb24b1..7a087cc 100755 --- a/src/main/java/com/lq/wechat/util/MessageUtil.java +++ b/src/main/java/com/lq/wechat/util/MessageUtil.java @@ -30,13 +30,13 @@ public class MessageUtil { * @throws DocumentException */ public static Map xmlToMap(HttpServletRequest req) throws IOException, DocumentException{ - Map map=new HashMap<>(); SAXReader reader=new SAXReader(); InputStream ins=req.getInputStream(); String resultString=IoUtil.convertStreamToString(ins); Document doc=DocumentHelper.parseText(resultString); Element root=doc.getRootElement(); List list=root.elements(); + Map map=new HashMap<>(list.size()); for(Element e:list){ map.put(e.getName(), e.getText()); }