public static <T> List<T> copyMapToBean(
   List<Map<String, Object>> resultMap, Class<T> cls) throws Exception {
  if (null == resultMap || resultMap.size() == 0 || null == cls) {
   return null;
  }
  // 结果集
  List<T> beanList = new ArrayList<T>();
  for (Map<String, Object> map : resultMap) {
   T bean = cls.newInstance();
   Set<String> keySet = map.keySet();
   for (String key : keySet) {
    BeanUtils.setProperty(bean, key, map.get(key));
   }

   beanList.add(bean);
  }

  return beanList;
 }

相关文章:

  • 2021-11-02
  • 2021-10-12
  • 2021-12-27
  • 2021-11-19
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-11
  • 2021-10-17
  • 2021-11-17
  • 2021-06-25
  • 2021-12-22
  • 2022-12-23
相关资源
相似解决方案