第一种写法(1):
原符号 < <= > >= & ' "
替换符号 < <= > >= & ' "
例如:
原sql如下:
SELECT C.GEO_CASEID CASEID, C.CRDATE CRDATA, C.VEH_VIN VIN, C.VEH_REGISTRATION REGNO, C.REP_CALLER CALLER FROM AQS_CASE C WHERE C.GEO_OWNER = 'ABC' AND C.REP_PHONE = '13611268491' AND C.CRDATE > TO_CHAR(SYSDATE - 3) AND C.CRDATE < TO_CHAR(SYSDATE)
放在mybatis xml后
SELECT C.GEO_CASEID caseid,
C.CRDATE crdata,
C.VEH_VIN vin,
C.VEH_REGISTRATION regno,
C.REP_CALLER caller
FROM AQS_CASE C
WHERE C.GEO_OWNER = #{ownerCode}
AND C.REP_PHONE = #{phone}
AND C.CRDATE > TO_CHAR(SYSDATE - 3)
AND C.CRDATE <= TO_CHAR(SYSDATE)
ORDER BY C.CRDATE DESC
第二种写法(2):
大于等于
<![CDATA[ >= ]]>
小于等于
<![CDATA[ <= ]]>
例如:sql如下:
create_date_time <![CDATA[ >= ]]> #{startTime} and create_date_time <![CDATA[ <= ]]> #{endTime}