@Transactional(readOnly = false) public int updateDevice(DeviceView deviceView) { if (deviceView == null || deviceView.getId() == null) { return 0; } String mac = deviceView.getMac(); if (mac != null) { mac = mac.toUpperCase(); deviceView.setMac(mac); } deviceView.setModifyuser(ShiroDbRealm.getCurrentLoginName()); return deviceMapper.update(deviceView); }
@Transactional(readOnly = false) public int saveDevice(DeviceView deviceView) { if (deviceView == null || deviceView.getAreaid() == null || deviceView.getName() == null || deviceView.getTypeid() == null || deviceView.getIp() == null) { return 0; } String mac = deviceView.getMac(); if (mac != null) { mac = mac.toUpperCase(); deviceView.setMac(mac); } deviceView.setId(IdUtils.uuid2()); deviceView.setCreateuser(ShiroDbRealm.getCurrentLoginName()); return deviceMapper.insert(deviceView); }