// 注意有空格 赞 踩 与boolean比较 choose -when -otherwise ifnull(exp,v) 赞 踩 Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。
mybatis if 详解
1.if test 比较
<when test="item.attrDbKey == 'brand_name'.toString()">
//
<when test="item.attrDbKey=='brand_name'">
//hasRelated 为boolean型
<if test="hasRelated">
2.if else写法
<choose>
<when test="item.id != null and item.id !=''">
#{item.id,jdbcType=CHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
补充:
当exp为null,用v表示他的值。
sql中exp若表示表字段,值得是该字段对应的值