Mybatis greater than less than or equal wording determination

In the mybatisoften used in greater than, less than or equal to comparison. However, the direct use > , < and other symbols will cause a syntax error. To address this issue, there are the following two solutions.

A method, instead of using the replacement symbols is greater than less than the original symbols such
The original symbol > < >= <= & ' "
Replace wording &gt; &lt; &gt;= &lt;= &amp; &apos; &quot;

EG : select * from table where number &gt; 50lookup table numberdata 50 is greater than

The second method using CDATA label or package wrapping determination statement special symbols.

CADATAHelp on behalf of xml parser text data parsing. CDATA using tags from <![CDATA[the beginning, by the ]]>end. Namely:<![CDATA[ sql语句 ]]> . Here SQL statement written normally, greater than less than other symbols can be used normally.
EG :select * from table where <!<CDATA[ number > 50 ]]>

Reproduced in: https: //www.jianshu.com/p/e2d90b348e24

Guess you like

Origin blog.csdn.net/weixin_33859504/article/details/91074629
Recommended