| | |
| | | pole.setUserId(-1L); |
| | | } |
| | | ); |
| | | //删除 |
| | | |
| | | //删除用户后需要自动解绑该用户的设备 |
| | | |
| | | //灯杆id集合 |
| | | List<Long> collect = poles.stream().map(p -> p.getId()).collect(Collectors.toList()); |
| | | List<Long> collect1 = poles.stream().map(Pole::getId).collect(Collectors.toList()); |
| | | //删除绑定关系 |
| | | SpringContextHolder.getBean(PoleBindingService.class) |
| | | .remove(Wrappers.lambdaQuery(PoleBinding.class) |
| | | .in(PoleBinding::getPoleId, collect)); |
| | | //更改灯杆归属 |
| | | flag = SpringContextHolder.getBean(PoleService.class).updateBatchById(poles); |
| | | |
| | | |
| | | //删除失败回滚数据 |
| | | if (!flag) { |
| | | throw new BusinessException("删除用户失败!"); |