| | |
| | | import java.math.BigInteger; |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map mapData = new HashMap<>(); |
| | | for (int i = 0, n = propertyDescriptors.length; i <n ; i++) { |
| | | PropertyDescriptor descriptor = propertyDescriptors[i]; |
| | | String propertyName = descriptor.getName(); |
| | |
| | | |
| | | if (result != null) { |
| | | if ("data".equals(propertyName)){ |
| | | if(existFild == null){ |
| | | returnMap.putAll((Map) result); |
| | | }else{ |
| | | Map resulMap = (Map) result; |
| | | for (Object o : resulMap.keySet()) { |
| | | if(existFild.contains(o)){ |
| | | returnMap.put(o,resulMap.get(o)); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | mapData = (Map) result; |
| | | }else if(existFild.contains((fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName).toLowerCase())){ |
| | | returnMap.put(fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName, result); |
| | | } |
| | | } else { |
| | | } else if(existFild.contains((fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName).toLowerCase())){ |
| | | returnMap.put(fieldMap.containsKey(propertyName)?fieldMap.get(propertyName):propertyName, ""); |
| | | } |
| | | } |
| | | } |
| | | //作用主要用于已MAP中的数据为准,bean里面遇到字段相同也会进行覆盖。 |
| | | if(existFild == null){ |
| | | returnMap.putAll((Map) mapData); |
| | | }else{ |
| | | Map resulMapChild = (Map) mapData; |
| | | for (Object o : resulMapChild.keySet()) { |
| | | if(existFild.contains(String.valueOf(o).toLowerCase())){ |
| | | returnMap.put(String.valueOf(o).toLowerCase(),resulMapChild.get(o)); |
| | | } |
| | | } |
| | | } |
| | |
| | | // String sqlField = camelToUnderscore(key); |
| | | |
| | | |
| | | if (map.containsKey(key.toUpperCase())) { |
| | | if (map.containsKey(key.toUpperCase(Locale.ROOT))||map.containsKey(key.toLowerCase(Locale.ROOT))) { |
| | | try { |
| | | Object value = map.get(key.toUpperCase()); |
| | | Object value=""; |
| | | if (map.containsKey(key.toUpperCase(Locale.ROOT))) { |
| | | value = map.get(key.toUpperCase()); |
| | | }else if(map.containsKey(key.toLowerCase(Locale.ROOT))){ |
| | | value = map.get(key.toLowerCase()); |
| | | } |
| | | // 得到property对应的setter方法 |
| | | Method setter = property.getWriteMethod(); |
| | | Class<?> type = property.getPropertyType(); |
| | |
| | | return beanList; |
| | | } |
| | | |
| | | |
| | | public static String camelToUnderscore(String name) { |
| | | if (name == null && name.length() <= 0) { |
| | | return name; |