1. 程式人生 > >mybatis 之 if test 條件,引數為0時,查詢條件未輸出

mybatis 之 if test 條件,引數為0時,查詢條件未輸出

解決方法: 將
<if test=" null != tagtype and ‘’!= tagtype">             AND tagtype = #{tagtype} </if> 修改為 <if test=" null != tagtype and ''  0 != tagtype">             AND tagtype = #{tagtype} </if> 原因就是 忽略了引數為 0  就代表引數型別時int 預設值應該是 0