解决方法:
将
<if test=" null != tagtype and ‘’!= tagtype">
AND tagtype = #{tagtype}
</if>
修改为
<if test=" null != tagtype and ''
0 != tagtype">
AND tagtype = #{tagtype}
</if>
原因就是 忽略了参数为 0 就代表参数类型时int 默认值应该是 0
本文解决了一个关于MyBatis中if标签判断逻辑的问题,当参数为0时,由于默认被视为NULL而导致条件不成立。通过调整if标签内的测试条件解决了此问题。
1635

被折叠的 条评论
为什么被折叠?



