欢迎投稿

今日深度:

mybaits的xxMapper.xml文件中大于号和小于号处理,大

mybaits的xxMapper.xml文件中大于号和小于号处理,大于号小于号


第一种方法:

因为这个是xml格式的,所以不允许出现类似“>”这样的字符,但是都可以使用<![CDATA[ ]]>符号进行说明,将此类符号不进行解析 。 mapper文件示例代码:

<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> 
  and isdelete=#{isdelete,jdbcType=TINYINT}  
  and <![CDATA[</span>date_sub(curdate(), INTERVAL 30 DAY) <= date(crt_time)]]> 
  order by crt_time desc
</select>





第二种方法:
用了转义字符把>和<替换掉。 mapper文件示例代码:
<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> 
  and isdelete=#{isdelete,jdbcType=TINYINT}  
  and date_sub(curdate(), INTERVAL 30 DAY) &lt= date(crt_time) 
  order by crt_time desc
</select>


附:转义字符表。

&lt; < 小于号
&gt; > 大于号
&amp; &
&apos; ' 单引号
  &quot;
" 双引号






 mapper文件示例代码:

maven 项目文件旁边的大于号什意思?

因为你用的是 git 做版本管理,如果文件有修改并且这个修改没有提交,就显示一个大于号
 

my sql 中的符号“>>”是啥意思,两个大于号

>> 是位运算符
位运算是将给点的操作数转化为二进制后,对每个操作数每一位都进行指定的逻辑运算,得到的二进制结果转换为十进制数后就是位运算的结果。

mysql> SELECT 4 >> 2;
-> 1

4的二进制为100,右移两位二进制为1,十进制也是1.

其实移位相当与乘除法,向右移两位其实是除以2的2次方。
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/2999.html NewsArticle mybaits的xxMapper.xml文件中大于号和小于号处理,大于号小于号 第一种方法: 因为这个是xml式的,所以不允许出现类“”这样的字符,但是都可以使用![CDATA[ ]]符号进行说明,将此类符号...
相关文章
    暂无相关文章
评论暂时关闭