Mybatis if test 中int integer判断非空的坑

Mybatis 中,alarmType 是int类型。如果alarmType 为0的话,条件判断返回结果为false,其它值的话,返回true。

 

1 <if test="alarmType != null and alarmType != ''">
2    alarm_type=#{alarmType},
3 </if>

if(!zxyf.equals("")){
pd.put("zxyf", Convert.filterInteger(zxyf));
}

<if test="pd.zxyf!=null and pd.zxyf!=''">
and months_between(sq.zxrq,dj.djrq) <![CDATA[>=]]> ${pd.zxyf}
and months_between(sq.zxrq,dj.djrq) <![CDATA[<]]> (${pd.zxyf}+1)
</if>

<if test="pd.zxyf!=null">
and months_between(sq.zxrq,dj.djrq) <![CDATA[>=]]> 0
and months_between(sq.zxrq,dj.djrq) <![CDATA[<]]> 1
</if>

posted @ 2018-03-23 18:04  神只吃苹果  阅读(8810)  评论(0编辑  收藏  举报