ibats注意

<isNotEqual property="id" compareValue="0" prepend="and">
id=#id#
</isNotEqual>

这个并不检查id是否为空!!!如果id为空,就会把这个id=?传给数据库进行查询就会有问题!!

可以写成这样

<isNotNull property="id" prepend="and">
<isNotEqual property="id" compareValue="0" prepend="and">
id=#id#
</isNotEqual>
</isNotNull>

原文地址:https://www.cnblogs.com/huhuuu/p/5238987.html