xml中的模糊查询


 

select * from a
<where>
<!-- 模糊查询 -->
  <if test="null != name and name !=''">
    and name like '%'||#{name}||'%' //name like '%${name}%'
  </if>
  <if test="null != age and age != ''">
    and name = #{age}
  </if>
  <if test="sex !=null and sex!=''">
    and sex = #{sex}
  </if>
</where>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM