MyBatis中特殊符号处理

MyBatis的转义

mybatis 中 SQL 写在mapper.xml文件中,而xml解析 < 、>、<=、>= 时会出错,这时应该使用转义写法。有两种解决方案:

方案一:

<    <=    >    >=    '    "    &
&lt;    &lt;=    &gt;    &gt;=    &apos;    &quot;    &amp;
方案二:

<![CDATA[ sql语句 ]]>

num <![CDATA[ >=  ]]> #{num}

原文链接:https://blog.csdn.net/xiaowanzi_zj/article/details/124706018

猜你喜欢

转载自blog.csdn.net/qq_19343089/article/details/129238968