#{type.typeName}
比如 是bookInfo
下面的 属性 type 的
type有 get typeName的方法
但是sql里面正常替换
但是 if标签 test=里面写就不行
是不支持吗?
if test="type.typeName!=null and type.typeName!=''"
if 判断是需要用 == 的 而不是 =
首先你要弄懂test里面写的是什么,其次你写在sql里面是什么样的,你就知道为什么不支持了
因为你写在test里面的这个属性没有,你怎么会有效果
判断属性里面的属性的话要先判断这个对象属性是否存在,再去判断属性内的属性,就像这样
<if test="user != null">
<if test="user.username != null and user.username != ''">
and username like concat('%',#{user.username},'%')
</if>
</if>