如果动态sql
<if test = "id != null and id != ' ' "> id = #{id} </if>
如果id为int类型,则id = 0 不进入该判断
所以写成<if test = "id != null and id != ' ' or id == 0 "> id = #{id} </if>
如果动态sql
<if test = "id != null and id != ' ' "> id = #{id} </if>
如果id为int类型,则id = 0 不进入该判断
所以写成<if test = "id != null and id != ' ' or id == 0 "> id = #{id} </if>