<choose>
<when test='info.flag!=null and info.flag=="1"'>
where status > '0'
and a.likecode in (select id from sys_orgn where find_in_set(#{likecode}, ancestors))
</when>
<otherwise>
where status > '0'
and a.likecode = #{likecode}
</otherwise>
</choose>
(1)choose…when…otherwise…类似于java中的判断语句,when表示if,otherwise表示else。
(2)参数匹配字符串时,单引号应在外层,双引号将字符串引起来。
'info.flag!=null and info.flag=="1"'