当前位置:   article > 正文

23.7.25. where 1=1 可以解决where和后面有and的问题_where 1=1与where and

where 1=1与where and
 WHERE 1=1

        <if test="lotNo != null and lotNo != '' ">
            and l.lot_no LIKE concat('%',#{lotNo},'%')
        </if>

        <if test="itemId != null and itemId!='' ">
            and c.item_id = #{itemId}
        </if>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

这样就不用担心单lotNo存在的时候where后面有and的问题了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/273402
推荐阅读
相关标签
  

闽ICP备14008679号