1、UserMapper.xml 有一个 selectByUser 方法,这个方法用到了 like 查询条件,部分代码如下 。
<if test=” userNarne != null and userNarne ! = ””>
and user name like concat ( ’ 毛 ’, #{userNarne},’ 毡 ’ )
</if>
使用 concat 函数连接字符串
2、bind 标签可以使用 OGNL 表达式创建一个变量井将其绑定到上下文中
在 MySQL 中,这个函数支持多个参数,但在 Oracle 中只
支持两个参数。由于不 同数据库之间的语法差异 ,如果更换数据库,有些 SQL 语句可能就需要
重写。针对这种情况,可以使用 bind 标签来避免由于更换数据库带来的一些麻烦。将上面的
方法改为 bind 方式后,代码如下。
<if test=”userNarne != null and userNarne !=””>
<bind