mybatis中 if标签判断int或者Integer类型时注意:
如下图所示,其中的state字段是Integer类型的,我加了state!=’‘这个判断条件后,该判断就不生效了(众所周知,当字段类型为Date时,同样也不能使用time!=’'的判断条件)
<if test="state!=null and state!='' ">
and state= #{state}
</if>
应该去掉 !=‘’
<if test="state!=null">
and state= #{state}
</if>
经过测试后就可以正常进入if判断