qingmuchuanqi48

这种问题在xml处理sql的程序中经常需要我们来进行特殊处理。

     其实很简单,我们只需作如下替换即可避免上述的错误:

 

< <= > >= & \' "

&lt;

&lt;=

&gt;

&gt;=

&amp;

&apos;

&quot;

例如常见的时间比较:

<select id="select" parameterType="xxx" resultMap="xxx">
    select
        distinct
        <include refid="Base_Column_List" />
    from xxx
    <where>
        <if test="createDate != null">
            create_date <= #{createDate}
        </if>
    </where>
</select>

  正确写法

 

<select id="select" parameterType="xxx" resultMap="xxx">
    select
        distinct
        <include refid="Base_Column_List" />
    from xxx
    <where>
        <if test="createDate != null">
            create_date &lt;= #{createDate}
        </if>
    </where>
</select>

 

分类:

技术点:

相关文章:

  • 2022-02-25
  • 2021-09-26
  • 2022-01-16
  • 2022-01-29
  • 2021-12-12
  • 2021-12-15
  • 2022-01-06
猜你喜欢
  • 2021-11-02
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案