| | |
| | | @Override |
| | | @Transactional |
| | | public boolean saveFwDeviceScrap(FwDeviceScrapDTO dto) { |
| | | // 先保存报废记录,成功后再处理设备状态与逻辑删除 |
| | | boolean isSuccess = super.save(FwDeviceScrapWrapper.build().entityDTO(dto)); |
| | | if (isSuccess) { |
| | | FwDeviceEntity fwDevice = new FwDeviceEntity(); |
| | | fwDevice.setId(dto.getDeviceId()); |
| | | fwDevice.setStatus(3); |
| | | // 更新设备状态并做逻辑删除,保持报废与设备状态一致 |
| | | isSuccess = fwDeviceService.updateById(fwDevice) && fwDeviceService.deleteLogic(Collections.singletonList(fwDevice.getId())); |
| | | } |
| | | return isSuccess; |
| | |
| | | |
| | | @Override |
| | | public IPage<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage<FwDeviceScrapVO> page, FwDeviceScrapDTO fwDeviceScrap) { |
| | | // 按当前部门及下级部门范围过滤数据 |
| | | List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId())); |
| | | fwDeviceScrap.setDeptList(deptList); |
| | | return page.setRecords(baseMapper.selectFwDeviceScrapPage(page, fwDeviceScrap)); |