标签:ret 查询 span public find else optional save ice
查询
public Object lookupDevice(Integer id) { return deviceJpa.findById(id).orElse(null); }
更新
public Object updateDevice(Integer id) { Optional<Device> optionalDevice = deviceJpa.findById(id); if (optionalDevice.isPresent()) { Device device=optionalDevice.get(); device.setSerial("HEHHEHEEH"); return deviceJpa.save(device); } return null; }
标签:ret 查询 span public find else optional save ice
原文地址:https://www.cnblogs.com/noigel/p/12072110.html