Mybatis的choose when otherwise

<select id="getCount" resultType="int">
select count(1) from
<choose>
<when test='type!=null and type=="2"'> (或者<when test="type!=null and type=='2'.toString()">)
t_evaluate_training t,t_training_org tt
</when>
<otherwise>
t_evaluate_company t,t_company_info tt
</otherwise>
</choose>
where t.company_id=tt.id
and t.del_flag=1
and tt.del_flag=1
<if test="userId!=null">
and t.evaluate_user=#{userId}
</if>
</select>
原文地址:https://www.cnblogs.com/esther-qing/p/6183502.html