where标记的作用类似于动态sql中的set标记,他的作用主要是用来简化sql语句中where条件判断的书写的,如下所示:

  <select id="selectByParams" parameterType="map" resultType="user">

    select * from user

    <where>

      <if test="id != null ">id=#{id}</if>

      <if test="name != null and name.length()>0" >and name=#{name}</if>

      <if test="gender != null and gender.length()>0">and gender = #{gender}</if>

    </where>

  </select>     

  在上述SQL中加入ID的值为null的话,那么打印出来的SQL为:select * from user where name="xx" and gender="xx"

  where 标记会自动将其后第一个条件的and或者是or给忽略掉

最新文章

  1. 解决Centos/Redhat,命令不存在
  2. python 实现简单排序
  3. JavaScript 总结几个提高性能知识点
  4. CSS3-Media Query 基础
  5. Leetcode#106 Construct Binary Tree from Inorder and Postorder Traversal
  6. JQuery DataTable插件
  7. 【动态规划】洛谷P1004方格取数
  8. 剑指Offer——网易笔试之不要二——欧式距离的典型应用
  9. saltstack主机管理项目:计主机管理项目命令分发器(三)
  10. 小兔的棋盘(hdu2067)
  11. git学习之时光穿梭机
  12. 零散的python知识点
  13. 2019.04.13 python基础
  14. (拼接SQL语句)mysql中date类型,datetime类型
  15. codeforces724G Xor-matic Number of the Graph
  16. Oracle 锁的等级
  17. 微信小程序echart 折线图legend不显示的问题
  18. 将 HPC 作业从本地计算机提交到部署在 Azure 中的 HPC Pack 群集
  19. ad各层
  20. new 运算符干了什么

热门文章

  1. SQLite不支持的SQL语法总结
  2. ThreadPoolExecutor的学习
  3. java的报表下载代码excel
  4. Redis基础
  5. 13. 用Roberts、Sobel、Prewitt和Laplace算子对一幅灰度图像进行边缘检测。观察异同。
  6. centos Linux 统计某个文件夹占用空间大小
  7. 【转载】COM:IUnknown、IClassFactory、IDispatch
  8. Mysql 中 text类型和 blog类型的异同
  9. How to crack interviews ...
  10. Object-c:两种文件读写的对比