| | |
| | | @PostMapping("/code/remove/{ids}") |
| | | @Transactional |
| | | public R remove(@PathVariable Long[] ids) { |
| | | List<Long> affectedCodeIds = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | Code code = codeService.getById(id); |
| | | if (null == code) { |
| | | continue; |
| | | } |
| | | affectedCodeIds.addAll(routeService.getAdjacencyNode(code.getId())); |
| | | codeGapService.remove(new LambdaQueryWrapper<CodeGap>().eq(CodeGap::getCode0, code.getId()).or().eq(CodeGap::getCode1, code.getId())); |
| | | routeService.remove(new LambdaQueryWrapper<Route>().eq(Route::getStartCode, code.getId()).or().eq(Route::getEndCode, code.getId())); |
| | | if (!codeService.removeById(id)) { |
| | |
| | | CodeServiceImpl.CODE_DATA_CACHE.remove(code.getData()); |
| | | } |
| | | } |
| | | codeService.refreshCornerByCodeIds(affectedCodeIds); |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |