zl程序教程

您现在的位置是:首页 >  后端

当前栏目

MyBatis的mapper.xml中SQL包含大于号等符号处理

mybatisSQLXML 处理 包含 符号 Mapper
2023-09-14 09:00:01 时间

xml处理sql的程序中,大于号小于号等符号需要进行特殊处理

按照下面的进行替换

< <= > >=
&lt; &lt;= &gt; &gt;=
 

 

 

eg:

<select id="getReading" resultMap="BaseResultMap">
        select * from files where status=2 and ifc_status=0
        <choose>
            <when test="dealBigFiles == 0">
                and size &lt;= #{maxFileSize}
            </when>
            <otherwise>
                and size &gt; #{maxFileSize}
            </otherwise>
        </choose>
        order by id asc limit 1
</select>