1、MyBatis Mapper文件中的if 标签判断特定字符串是否相等:
<!-- 仅仅查询普通用户 -->
<if test="isCommon != null and isCommon !=''">
<if test="isCommon == '1'.toString()">
AND AUTH_USER.USER_CATEGORY = 'COMMON_USER'
</if>
</if>
2、MyBatis Mapper 文件中的delete 标签批量删除用户集合
<delete id="deleteBySids" parameterType="java.util.List">
delete from data_category where id_ in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
3、MyBatis Mapper文件中choose when otherise 标签使用= if else 标签
<!--if else 标签判断 -->
<choose>
<when test="order != null and order != '' and order == '1'.toString()">
order by arch_info.created_dt desc
</when>
<otherwise>
order by arch_info.created_dt asc
</otherwise>
</choose>
4、MyBatis Mapper 文件中if 标签判断整数类型是否相等
<choose>
<when test="type!= null and type== 2">
and type = 2
</when>
<otherwise>
and type = 1
</otherwise>
</choose>
注意:mybatis默认将integer=0的参数等于‘’空串 = type ==''
5、MyBatis Mapper 文件中if 标签判断List 集合不能为空
<if test="sids != null and sids.size() > 0">
and sid not in
<foreach collection="sids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>