mybatis int 类型判断

时间:2022-07-05 04:01:58

   如果数据类型是integer或者int,也就是数据类型的,在用<if>标签做动态语句的时候 不用判断是否为"''"

<if test="sex != null">
`sex` = #{sex},
</if>
<if test="mobile != null and mobile != ''">
`mobile` = #{mobile},
</if>

  而字符类型则需要判断,例子如上,sex是integer类型的,mobile是字符类型的