| | |
| | | invocation.getArgs()[PARAMETER_INDEX] = entity; |
| | | }else if(entity instanceof Map){ |
| | | try { |
| | | ((List)((Map<?, ?>) entity).get("list")).forEach(e -> { |
| | | if (e instanceof BaseEntity) { |
| | | Class<?> entityClass = e.getClass(); |
| | | Method setIdMt = null ; |
| | | try{ |
| | | setIdMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME, Long.class) ; |
| | | if(setIdMt != null){ |
| | | setIdMt.invoke(e, new IDLongGenerator().generate()); |
| | | Map<?, ?> map = (Map)entity; |
| | | List list = (List)map.get("list") ; |
| | | if(list != null && list.size() > 0){ |
| | | IDLongGenerator idg = new IDLongGenerator() ; |
| | | list.forEach(e -> { |
| | | if (e instanceof BaseEntity) { |
| | | Class<?> entityClass = e.getClass(); |
| | | Method setIdMt = null ; |
| | | try{ |
| | | setIdMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME, Long.class) ; |
| | | if(setIdMt != null){ |
| | | setIdMt.invoke(e, idg.generate()); |
| | | } |
| | | }catch (Exception e1){ |
| | | //当entityClass没有setId方法时,会抛出异常 |
| | | } |
| | | }catch (Exception e1){ |
| | | //当entityClass没有setId方法时,会抛出异常 |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }catch (Exception e){ |
| | | |
| | | } |