Mybatis的choose类似于java中的switch
具体用法如下:
select *
from table
<where>
<choose>
<!-- when类似于Java的case 当有一个分支满足时不再执行其他分支 -->
<when test = "num == 1">
id = 1
</when>
<when test = "num == 2">
id = 2
</when>
<!-- 当所有分支不满足条件时 执行otherwise 类似于java中的default -->
<otherwise>
id is not null
</otherwise>
</choose>
</where>