mybatis if-else(写法)
- mybaits 中没有else要用chose when otherwise 代替
范例
<select id="selectSelective" resultMap="xxx" parameterType="xxx">
select
<include refid="Base_Column_List"/>
from xxx
where del_flag=0
<choose>
<when test="xxx !=null and xxx != ''">
and xxx like concat(concat('%', #{xxx}), '%')
</when>
<otherwise>
and xxx like '**%'
</otherwise>
</choose>
</select>
范例
<choose>
<when test="">
//...
</when>
<otherwise>
//...
</otherwise>
</choose>