注意增强代码逻辑,过滤掉不需要的数据

注意代码适合所有的数据库,以下代码在oracle中是正常的,orcale会自动将空字符串当做null进行存储:

if(specialPermit.get("content")!=null)  {
                                content = specialPermit.get("content").toString();

}

但上述情况在sqlServer中就是错误的了,sqlserver会将空字符串存储为空字符串,所以需要加空字符串判断:

if(specialPermit.get("content")!=null&&!specialPermit.get("content").toString().isEmpty())  {
                                content = specialPermit.get("content").toString();

}
原文地址:https://www.cnblogs.com/toSeeMyDream/p/5175702.html