ibatis中使用like时怎么避过sql注入

ibatis中使用like时如何避过sql注入普通的拼写方式为:if testremark ! null and remark ! and re

ibatis中使用like时如何避过sql注入
普通的拼写方式为:
<if test="remark != null and remark != ''">and remark like '%'+#{remark}+'%'</if>

如果遇到变量名刚好是数据库的关键字,拼写方式如下所示:
<if test="action != null and action != ''">
   <![CDATA[ 
     and action like '%'+#{action}+'%'
   ]]>
</if>