mybatis传入Integer类型的参数,当参数为0是,会被看做空字符串,所以不能空值判断不能用 !=”“
之前是这么写的
<sql id="where_condition">
<where>
1=1
<if test="isComplaint != null and isComplaint=''">
and is_complaint = #{isComplaint}
</if>
</where>
</sql>
发现传参isComplaint=0时,直接被过滤掉了
需要改成
<sql id="where_condition">
<where>
1=1
<if test="isComplaint != null">
and is_complaint = #{isComplaint}
</if>
</where>
</sql>