mapper.xml中sql语句比较符号的转义写法

在这里插入图片描述
错误写法

<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>

猜你喜欢

转载自blog.csdn.net/qq_43277087/article/details/106206774
今日推荐