无情的你无情的雨 2020-06-16
使用<bind/>标签进行模糊查询
bind 元素可以从 OGNL 表达式中创建一个变量并将其绑定到上下文,bind适用于mysql,sql server,oracle
<select id="getGoodsCondition" parameterType="Goods" resultType="Goods">
select * from mall_goods
<where>
<if test="name!=null and name!=‘‘">
<!--name,为目标数据源取名-->
<!--value,值的表达式-->
<bind name="goodsName" value="‘%‘ + name + ‘%‘"/>
name like #{goodsName}
</if>
</where>
</select>#{ }中的名字与,bind标签中的 name一致!