| | |
| | | import com.ruoyi.oa.domain.SgIpc; |
| | | import com.ruoyi.oa.mapper.SgIpcMapper; |
| | | import com.ruoyi.oa.service.ISgIpcService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | lqw.eq(bo.getOrganizationId() != null, SgIpc::getOrganizationId, bo.getOrganizationId()); |
| | | lqw.eq(bo.getConstructionBatchId() != null, SgIpc::getConstructionBatchId, bo.getConstructionBatchId()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getModel()), SgIpc::getModel, bo.getModel()); |
| | | lqw.orderByDesc(SgIpc::getUpdateTime); |
| | | return lqw; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean insertByBo(SgIpcBo bo) { |
| | | List<SgIpc> list = baseMapper.selectList(new LambdaQueryWrapper<SgIpc>() |
| | | .eq(SgIpc::getSchoolId, bo.getSchoolId()).eq(SgIpc::getMac, bo.getMac())); |
| | | if (list.size() > 0) { |
| | | throw new ServiceException("MAC重复", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | SgNvr nvr = nvrMapper.selectById(bo.getNvrId()); |
| | | if (!bo.getOrganizationId().equals(nvr.getOrganizationId())) { |
| | | throw new ServiceException("IPC所属单位与所选NVR所属单位不符", HttpStatus.HTTP_PARTIAL); |
| | | if (null != bo.getNvrId()) { |
| | | SgNvr nvr = nvrMapper.selectById(bo.getNvrId()); |
| | | if (!bo.getOrganizationId().equals(nvr.getOrganizationId())) { |
| | | throw new ServiceException("IPC所属单位与所选NVR所属单位不符", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | } |
| | | SgIpc add = BeanUtil.toBean(bo, SgIpc.class); |
| | | validEntityBeforeSave(add); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateByBo(SgIpcBo bo) { |
| | | List<SgIpc> list = baseMapper.selectList(new LambdaQueryWrapper<SgIpc>() |
| | | .eq(SgIpc::getSchoolId, bo.getSchoolId()) |
| | |
| | | if (list.size() > 0) { |
| | | throw new ServiceException("MAC重复", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | SgNvr nvr = nvrMapper.selectById(bo.getNvrId()); |
| | | if (!bo.getOrganizationId().equals(nvr.getOrganizationId())) { |
| | | throw new ServiceException("IPC所属单位与所选NVR所属单位不符", HttpStatus.HTTP_PARTIAL); |
| | | if (null != bo.getNvrId()) { |
| | | SgNvr nvr = nvrMapper.selectById(bo.getNvrId()); |
| | | if (!bo.getOrganizationId().equals(nvr.getOrganizationId())) { |
| | | throw new ServiceException("IPC所属单位与所选NVR所属单位不符", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | } |
| | | SgIpc update = BeanUtil.toBean(bo, SgIpc.class); |
| | | validEntityBeforeSave(update); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if (isValid) { |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |