The first method:
Because this is in XML format, characters like ">" are not allowed, but you can use <! [cdata[]]> symbols are described, and such symbols are not parsed. Mapper File Sample code:
<select id= "selectmonthadvertise" resultmap= "Resultmap" > select * from ad_n_advertise_t where user_id in <foreach item= "item" index= "index" collection= "Useridlist" open= "(" separator= "," close= ")" > #{item} </foreach> Isdelete=#{isdelete,jdbctype=tinyint} and <![ Cdata[</span>date_sub (Curdate (), INTERVAL) <= date (Crt_time)]]> ORDER by Crt_time desc</ Select>
The
second method:> and < were replaced with escape characters. Mapper File Sample code:
<select id= "selectmonthadvertise" resultmap= "Resultmap" > select * from ad_n_advertise_t where user_id in <foreach item= "item" index= "index" collection= "Useridlist" open= "(" separator= "," close= ")" > #{item} </foreach> Isdelete=#{isdelete,jdbctype=tinyint} and Date_sub (Curdate (), INTERVAL Day) <= Date (Crt_time) ORDER by Crt_time Desc</select>
attachment: An escape character descriptor.
| < |
< |
Less than sign |
| > |
> |
Greater than sign |
| & |
& |
And |
| ' |
‘ |
Single quotation marks |
"
|
" |
Double quotes |
Mapper File Sample code:
Mybaits and less-than-number processing in xxmapper.xml files