Mybatis greater than, less than, equal to escape in XML

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/TreeShu321/article/details/101475344

mybatis written in SQL mapper.xml file and parse xml <,>, <=,> = to be wrong, then you should use an escape wording.
A manner
<<=>> = ' "
<<=>> =' '
Example:

<if test="startDate != null">
          t1.NORM_RETURN_DATE  &gt;= #{startDate}
  </if>

Second way

<! [CDATA [sql statement]]>

Example:

 <if test="endDate != null">
      	 t1.NORM_RETURN_DATE &lt;= #{endDate}
   </if>

Guess you like

Origin blog.csdn.net/TreeShu321/article/details/101475344
Recommended