當sql配置文件中的元素select/insert/update中,須要使用大於號>和小於號<時。java
<![CDATA[sql
sql語句app
]]> spa
來將sql語句括起來,如:code
<select id="test_query" parameterType="hashmap" resultType="hashmap">
<![CDATA[
select t.f1,t.f2orm
from table txml
where t.f3 <> 1hash
]]>
<include refid="test_sql_common" />
</select>it
或者經過如下方式:table
<select id="findUserByCond" parameterClass="java.util.Map" resultMap="userMapping"> SELECT * FROM lol_user where 1=1 <isNotEmpty prepend=" AND " property="userName"> user_name like '%$userName$%' </isNotEmpty> <isNotEmpty prepend=" AND " property="realName"> real_name like '%$realName$%' </isNotEmpty> <isNotEmpty prepend=" AND " property="startTime"> create_time >= #startTime# </isNotEmpty> <isNotEmpty prepend=" AND " property="endTime"> create_time <= #endTime#</isNotEmpty> order by create_time desc limit #offset#,#pageSize# </select>