mybaits的xxMapper.xml檔案中大於符號和小於符號處理,大於符號小於符號

來源:互聯網
上載者:User

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次方。
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.