下面就是MyBatis中的if....else...表示方法
<choose>
<when test="">
//...
when>
<otherwise>
//...
otherwise>
choose>
例子
<select id="findActiveBlogLike"
resultType="Blog">
SELECT * FROM BLOG WHERE state = ‘ACTIVE’
<choose>
<when test="title != null">
AND title like #{title}
when>
<when test="author != null and author.name != null">
AND author_name like #{author.name}
when>
<otherwise>
AND featured = 1
otherwise>
choose>
select>