为什么不能正确识别值为0的参数?
mybatis中的自己写的判断方法
<if test="searchForm.buildingType != null and searchForm.buildingType !=''">
and a.building_type=#{searchForm.buildingType}
</if>
mybatis源码是这样的:
return s.length() == 0 ? 0.0D : Double.parseDouble(s);
参数为0,则0 == 0.0D 相等 ,就进不去if里面了
怎么解决这个问题?
添加or条件
<if test="searchForm.buildingType != null and searchForm.buildingType !='' or searchForm.buildingType==0">
and a.building_type=#{searchForm.buildingType}
</if>