//比较两个数组差异并更改
private void CompareAndUpdateColInfo(List<GetSysColInfoDTO> oldSourceColumnList, List<GetSysColInfoDTO> nowSourceColumnList) {
//基于字段名新增的对象
List<GetSysColInfoDTO> addColInfo = nowSourceColumnList.stream().filter(a -> !oldSourceColumnList.stream().map(GetSysColInfoDTO::getColName).collect(Collectors.toList()).contains(a.getColName())).collect(Collectors.toList());
//基于字段名减少的对象
List<GetSysColInfoDTO> removeColInfo = oldSourceColumnList.stream().filter(a -> !nowSourceColumnList.stream().map(GetSysColInfoDTO::getColName).collect(Collectors.toList()).contains(a.getColName())).collect(Collectors.toList());
if (addColInfo.size() > 0) {
addColInfo.forEach(e -> e.setTableId(oldSourceColumnList.get(0).getTableId()));
iSysColInfoService.saveBatch(SysColInfoConverter.INSTANCE.getSysColInfoList(addColInfo));
}
if (removeColInfo.size() > 0) {
List<Long> ids = new ArrayList<>();
removeColInfo.forEach(e -> ids.add(e.getId()));
iSysColInfoService.removeByIds(ids);
}
}