今天在写mapper文件时遇到integer类型参数时判断不为空,如下
<if test="status != null and status != ''">
SQL。。。
</if>
当status=0时,if语句没有执行。
究其原因,原来mybatis默认将integer=0的参数等于‘’空串。
今天在写mapper文件时遇到integer类型参数时判断不为空,如下
<if test="status != null and status != ''">
SQL。。。
</if>
当status=0时,if语句没有执行。
究其原因,原来mybatis默认将integer=0的参数等于‘’空串。