getInsertChangeItems为啥要单独写个方法getBeanSimpleFieldValueMap
如题,直接调用
Introspector.getBeanInfo // 获取bean的信息 // 获取属性值和属性称() for (PropertyDescriptor propertyDescriptor: beanInfo.getPropertyDescriptors()){ String field = propertyDescriptor.getName(); try { String value =getValue( PropertyUtils.getProperty(object, field)); if (value == null || value.equals("")){ continue; } ChangeItem changeItem = new ChangeItem(); changeItem.setOldValue(""); changeItem.setNewValue(value); items.add(changeItem); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } }
为啥要自己造轮子,感觉实现的功能都一样啊