/** * 初始化IP,将IP的状态设置为未使用状态,关联的HostServer设置为null. 如果IP不存在数据库中,则返回null值. * * @param ipAddress * @return */ public IpPool initIpPool(String ipAddress) { IpPool ipPool = ipPoolDao.findByIpAddress(ipAddress); if (ipPool != null) { ipPool.setStatus(IpPoolConstant.IpStatus.未使用.toInteger()); ipPool.setHostServer(null); return this.saveOrUpdate(ipPool); } return null; }
@Transactional(readOnly = false) public void updateIpPoolByIpAddress(String ipAddress, Integer status, HostServer hostServer) { // TODO 待优化,最终目标是删除此方法. IpPool ipPool = ipPoolDao.findByIpAddress(ipAddress); if (ipPool != null) { ipPool.setStatus(status); ipPool.setHostServer(hostServer); ipPoolDao.save(ipPool); } }
/** * 根据ipAddress获得指定的IpPool . * * @param ipAddress * @return */ public IpPool findIpPoolByIpAddress(String ipAddress) { return ipPoolDao.findByIpAddress(ipAddress); }