Foreword
- java 1.8 new in a forEach loop is very easy to use, when we write the interface background, the returned data sometimes need to add a field, then if modify the data table, then will be very complicated, resulting in unnecessary waste of time, Therefore, we can directly use the field to add the required cycle.
Renderings
Code
//用来保存处理完的对象
List<BankSysMenusPo> bSysMenusPo = new ArrayList<>();
从后台拿到的数据
List<Map<String, Object>> banksysMenusDto =sysService.bankChildrenMenu(sysId);
banksysMenusDto.forEach((data)->{
data.put("module", data.get("kid"));
data.put("id", data.get("kid"));
}