Appearance
mybatis if 等于判断
做等于判断时需要加 toString 方法
xml
<if test=" isLogin == '1'.toString() " >
is_login = #{isLogin}
</if >
1
2
3
2
3
mybatis if else
mybaits 中没有else要用chose when otherwise 代替
xml
<choose>
<when test="item.id != null and item.id !=''">
#{item.id,jdbcType=CHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8