Mybatis用if判断int类型参数为0会过滤
例子
当下列sql传入0时,通过if判断会自动跳过
delete from message_logging where 1=1
<if test="param1.sceneType != null and param1.sceneType != ''">
and scene_type = #{paramCondition.sceneType}
</if>
分析
原因在于判断!=''这个条件时OGNL会返回''的长度,因此!=''会变成!=0来判断

浙公网安备 33010602011771号