仅是简单记录,不代表这样是正确的。
错误的方法,使用StringUtils.isEmpty判断,会报空指针
if (StringUtils.isEmpty(entity.getVersionCode().toString())){
entity.setVersionCode(1L);
}
if (ObjectUtil.isNull(entity.getVersionCode())){
entity.setVersionCode(1L);
}
参考:http://www.zyiz.net/tech/detail-256445.html