阅读(4389) (0)

MyBatis 3 动态SQL-bind

2022-04-11 10:16:38 更新

bind

bind ​元素允许你在 ​OGNL​ 表达式以外创建一个变量,并将其绑定到当前的上下文。比如:

<select id="selectBlogsLike" resultType="Blog">
  <bind name="pattern" value="'%' + _parameter.getTitle() + '%'" />
  SELECT * FROM BLOG
  WHERE title LIKE #{pattern}
</select>