作用:
在xml中书写sql时,有些字符需要转义,比如 > (>),<( <),
而由<![CDATA[ ]]>标签包裹的语句,忽略xml的转义
例如:
select * from A where is_delete = '0'
<if test = "startTime= != null and startTime != '' and endTime= != null and ensTime != '' ">
<![CDATA[ and data_format(create_on, '%Y-%m') >= #{startTime} and data_format(create_on, '%Y-%m') <=#{endTime}]]>
</if>
# 最后的执行sql语句为:
select * from A where is_delete = '0'
and data_format(create_on, '%Y-%m') > = '2023-03' and data_format(create_on, '%Y-%m') < ='2022-12'