mybatis if test 不为空字符串或null

2017-12-08  本文已影响0人  墨色尘埃

MyBatis 判断条件为等于的问题
在双引号里面再判断不为空,使用单引号

  <if test="productId != null and productId !=''" >  
        and  a.product_id = #{productId,jdbcType=VARCHAR}  
      </if>  
  <if test="type!=null and type!=''">  
        AND type = #{type}  
  </if>  
<if test="extraSql != null and extraSql !=''">
   AND ${extraSql}
</if>
上一篇 下一篇

猜你喜欢

热点阅读