Mybatis的Xml中if-else写法,when会不会匹配多个

例子有点憨,将就看

<choose>
  <when test="id = 1">
  and id = 2
  </when>
  <when test="id = 2">
  and id = 3
  </when>
  <otherwise>
  and id is null
  </otherwise>
</choose>

choose中的when会不会匹配多个? 不会,从上到下判断,匹配到一个之后,其他的就不会匹配了

posted @ 2021-10-21 09:45  InkYi  阅读(429)  评论(0编辑  收藏  举报