| | |
| | | import com.gkhy.exam.common.api.CommonPage; |
| | | import com.gkhy.exam.common.api.CommonResult; |
| | | import com.gkhy.exam.common.constant.UserConstant; |
| | | import com.gkhy.exam.common.exception.ApiException; |
| | | import com.gkhy.exam.common.utils.PageUtils; |
| | | import com.gkhy.exam.common.utils.SecurityUtils; |
| | | import com.gkhy.exam.system.domain.AnnualMaintenance; |
| | |
| | | .in(AnnualMaintenanceDevice::getId, delDeviceIds) |
| | | ); |
| | | if (update <= 0){ |
| | | throw new RuntimeException("删除年度基础设施维护计划设备失败"); |
| | | throw new ApiException("删除年度基础设施维护计划设备失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | annualMaintenanceDevice.setCreateTime(LocalDateTime.now()); |
| | | int insert = annualMaintenanceDeviceMapper.insert(annualMaintenanceDevice); |
| | | if (insert <= 0){ |
| | | throw new RuntimeException("保存年度基础设施维护计划设备失败"); |
| | | throw new ApiException("保存年度基础设施维护计划设备失败"); |
| | | } |
| | | |
| | | List<AnnualMaintenanceDeviceType> annualMaintenanceDeviceTypes = annualMaintenanceDeviceSaveDTOReq.getAnnualMaintenanceDeviceTypes(); |
| | |
| | | annualMaintenanceDeviceType.setCreateTime(LocalDateTime.now()); |
| | | int insert1 = annualMaintenanceDeviceTypeMapper.insert(annualMaintenanceDeviceType); |
| | | if (insert1 <= 0){ |
| | | throw new RuntimeException("保存年度基础设施维护计划设备类型失败"); |
| | | throw new ApiException("保存年度基础设施维护计划设备类型失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | annualMaintenanceDevice.setUpdateTime(LocalDateTime.now()); |
| | | int update = annualMaintenanceDeviceMapper.updateById(annualMaintenanceDevice); |
| | | if (update <= 0){ |
| | | throw new RuntimeException("更新年度基础设施维护计划设备失败"); |
| | | throw new ApiException("更新年度基础设施维护计划设备失败"); |
| | | } |
| | | List<AnnualMaintenanceDeviceType> annualMaintenanceDeviceTypes = annualMaintenanceDeviceSaveDTOReq.getAnnualMaintenanceDeviceTypes(); |
| | | if (ObjectUtils.isNotEmpty(annualMaintenanceDeviceTypes)){ |
| | |
| | | annualMaintenanceDeviceType.setCreateTime(LocalDateTime.now()); |
| | | int insert1 = annualMaintenanceDeviceTypeMapper.insert(annualMaintenanceDeviceType); |
| | | if (insert1 <= 0){ |
| | | throw new RuntimeException("保存年度基础设施维护计划设备类型失败"); |
| | | throw new ApiException("保存年度基础设施维护计划设备类型失败"); |
| | | } |
| | | }else { |
| | | annualMaintenanceDeviceType.setUpdateBy(SecurityUtils.getUsername()); |
| | | annualMaintenanceDeviceType.setUpdateTime(LocalDateTime.now()); |
| | | int update1 = annualMaintenanceDeviceTypeMapper.updateById(annualMaintenanceDeviceType); |
| | | if (update1 <= 0){ |
| | | throw new RuntimeException("更新年度基础设施维护计划设备类型失败"); |
| | | throw new ApiException("更新年度基础设施维护计划设备类型失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | annualMaintenanceDeviceType.setUpdateTime(LocalDateTime.now()); |
| | | int update2 = annualMaintenanceDeviceTypeMapper.update(annualMaintenanceDeviceType, new LambdaQueryWrapper<AnnualMaintenanceDeviceType>().in(AnnualMaintenanceDeviceType::getAnnualMaintenanceDeviceId, deviceIds)); |
| | | if (update2 <= 0){ |
| | | throw new RuntimeException("删除数据失败"); |
| | | throw new ApiException("删除数据失败"); |
| | | } |
| | | } |
| | | }else { |
| | | throw new RuntimeException("删除数据失败"); |
| | | throw new ApiException("删除数据失败"); |
| | | } |
| | | |
| | | return CommonResult.success(); |