mybatis符号$换#出现问题

之前公司用$,看我没事做就叫我换#号试一下 结果发现一些问题

原来代码中的codition 是一段字符串 如

  where  t_applyUnit.BAU_CHECKSTATUS = '2'

在xml文件中直接在sql语句后面加上${codition}使用 但是我改成#以后出现问题 似乎自动加了个\似得

 ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' where  t_applyUnit.BAU_CHECKSTATUS = \'2\''' at line 53
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' where  t_applyUnit.BAU_CHECKSTATUS = \'2\''' at line 53

结果发现好像是输出的语句中前后多了双引号

在mybatis中,
$就将语句直接方在变量出,比如where age=${age},age是12,那解析出来就是where age=12
#是认为变量是字符变量,所以会在前后添加单引号,比如where username=#{username},username是abc,解析出来就是where username='abc'