失效链接处理 |
Mybatis在Mapper.xml文件中的转义字符处理方式 PDF 下载
本站整理下载:
相关截图:
主要内容:
2、使用CDATA标志处理转义字符
3、应用案例
<![CDATA[ sql语句 ]]> //使用<![CDATA[ sql语句 ]]>来处理 <select id="selectByPage" resultMap="BaseResultMap"> select *,Date(expire_date)-current_date as expireDays from tb_insurance <where> <if test="vehicleNum != null and vehicleNum != ''"> and vehicle_num = #{vehicleNum} </if> <choose> <when test="typeName == '即将到期'.toString()"> and Date(expire_date)-current_date <![CDATA[ > 0 ]]> and Date(expire_date)-current_date <![CDATA[ <= # {expireDays,jdbcType=INTEGER}]]> </when> <when test="typeName == '已过期'.toString()"> and current_date-Date(expire_date) <![CDATA[ >= # {expireDays,jdbcType=INTEGER}]]> </when> <otherwise> and Date(expire_date)-current_date <![CDATA[ <= 30]]> </otherwise>
</choose> </where> </select> //使用对应的转义字符来处理 <select id="selectByPage" resultMap="BaseResultMap" parameterType="int"> SELECT id,time FROM (SELECT rownum as rn , t.id,t.time FROM person t ORDER BY t.id) WHERE rn >= #{startIndex} AND rn <= #{endIndex} </select>
|