折雨的天空
ruoyi-vue-plus中判断数值型变量,是否为空
2022-7-11 我好笨


仅是简单记录,不代表这样是正确的。







错误的方法,使用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

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容