直接在mapper.xml
中写 <
小于号是会报错的,需要我们做一个替换处理。
< | <= | > | >= | & | ’ | " |
---|---|---|---|---|---|---|
< | <= | > | >= | & | ' | " |
错误写法:报错
<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 <= #{createDate}
</if>
</where>
</select>