您的位置:首页 > 其它

【mybatis】<![CDATA[]]>使用方法

2018-01-02 16:09 435 查看
目的:XML中不希望转义的SQL可以写入<![CDATA[   ]]括号里面,比如where中常用的>、<=、& 等字符。因为写在[ ]里面的内容会被解析器忽略。

注意:<if>、<where>  等标签不要写里面,因为这些标签页不会被解析。尽量简化<![CDATA[
 ]]> 中的代码。<select id="selectByTS" resultMap="BaseResultMap" parameterType="com.tianrui.dc.dao.nc.bean.BdCustorg">
select
<include refid="Base_Column_List" />
from BD_STORDOC tti
<where>
<if test="enablestate !=null and enablestate !=''">
enablestate =#{enablestate,jdbcType=DECIMAL}
</if>
<if test='maxTs != null and maxTs!="" '>
<![CDATA[and to_date(tti.ts,'yyyy/mm/dd hh24:mi:ss') >to_date(#{maxTs},'yyyy/mm/dd hh24:mi:ss')]]>
</if>
</where>
</select>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: