mybatis if test 不为空字符串或null

野性酷女 2023-10-17 10:13 164阅读 0赞
  1. <sql id="public_content">
  2. <if test="productId != null and productId !=''" >
  3. and a.product_id = #{productId,jdbcType=VARCHAR}
  4. </if>
  5. <if test="productDefinId != null" >
  6. and a.product_defin_id = #{productDefinId,jdbcType=VARCHAR}
  7. </if>
  8. <if test="productUid != null and productUid !=''">
  9. and a.product_uid = #{productUid,jdbcType=VARCHAR}
  10. </if>
  11. <if test="productKey != null" >
  12. and a.product_key = #{productKey,jdbcType=VARCHAR}
  13. </if>
  14. <if test="prouuctSecret != null" >
  15. and a.prouuct_secret = #{prouuctSecret,jdbcType=VARCHAR}
  16. </if>
  17. <if test="productPass != null" >
  18. and a.product_pass = #{productPass,jdbcType=VARCHAR}
  19. </if>
  20. <if test="productVisitPass != null" >
  21. and a.product_visit_pass = #{productVisitPass,jdbcType=VARCHAR}
  22. </if>
  23. <if test="createTime != null and createTime !=''" >
  24. and a.create_time = #{createTime,jdbcType=VARCHAR}
  25. </if>
  26. <if test="pageSize != null and pageNum !=null " >
  27. ORDER BY a.product_id DESC limit #{pageNum},#{pageSize}
  28. </if>
  29. </sql>

发表评论

表情:
评论列表 (有 0 条评论,164人围观)

还没有评论,来说两句吧...

相关阅读