Mybatis sql map 小于号配置

时间:2023-03-09 19:03:56
Mybatis sql map 小于号配置

Mybatis SQL map配置中出现小于号转义时,通过<![CDATA[查询条件]]>解决。

EXCEMPLE:

<select id="getComments" parameterType="Pagination" resultType="CustomerComments">
  SELECT * FROM kk_customercomments
  <if test="condition != null">
    WHERE true
      <if test="condition.enddate != null">
        and <![CDATA[COMMENTSDATE <= '${condition.enddate}']]>
      </if>
  </if>
</select>