In the mybatis
often 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 | > | < | >= | <= | & | ' | " |
EG : select * from table where number > 50
lookup table number
data 50 is greater than
The second method using CDATA label or package wrapping determination statement special symbols.
CADATA
Help 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