成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

Mybatis傳輸List的實現(xiàn)代碼

1. 當查詢的參數(shù)只有一個時

專業(yè)領域包括網(wǎng)站制作、成都網(wǎng)站建設、商城網(wǎng)站定制開發(fā)、微信營銷、系統(tǒng)平臺開發(fā), 與其他網(wǎng)站設計及系統(tǒng)開發(fā)公司不同,創(chuàng)新互聯(lián)公司的整合解決方案結合了幫做網(wǎng)絡品牌建設經(jīng)驗和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結合,為客戶提供全網(wǎng)互聯(lián)網(wǎng)整合方案。

findByIds(List<Long> ids)

 1.1 如果參數(shù)的類型是List, 則在使用時,collection屬性要必須指定為 list

Xml代碼

<select id="findByIdsMap" resultMap="BaseResultMap"> 
 Select 
 <include refid="Base_Column_List" /> 
 from jria where ID in 
 <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> 
 #{item} 
 </foreach> 
</select> 
<select id="findByIdsMap" resultMap="BaseResultMap"> 
 Select 
 <include refid="Base_Column_List" /> 
 from jria where ID in 
 <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> 
 #{item} 
 </foreach> 
</select> 
 findByIds(Long[] ids)

 1.2 如果參數(shù)的類型是Array,則在使用時,collection屬性要必須指定為 array

Xml代碼

<select id="findByIdsMap" resultMap="BaseResultMap"> 
select 
<include refid="Base_Column_List" /> 
from tabs where ID in 
<foreach item="item" index="index" collection="array" open="(" separator="," close=")"> 
 #{item} 
</foreach> 
  </select> 
<select id="findByIdsMap" resultMap="BaseResultMap"> 
select 
<include refid="Base_Column_List" /> 
from tabs where ID in 
<foreach item="item" index="index" collection="array" open="(" separator="," close=")"> 
 #{item} 
</foreach> 
  </select> 

2. 當查詢的參數(shù)有多個時,例如 findByIds(String name, Long[] ids)

 這種情況需要特別注意,在傳參數(shù)時,一定要改用Map方式, 這樣在collection屬性可以指定名稱

         下面是一個示例     

Map<String, Object> params = new HashMap<String, Object>(2);
     params.put("name", name);
     params.put("ids", ids);
    mapper.findByIdsMap(params);

Xml代碼

<select id="findByIdsMap" resultMap="BaseResultMap"> 
 select 
 <include refid="Base_Column_List" /> 
 from tabs where ID in 
 <foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> 
 #{item} 
 </foreach> 
</select> 

總結

以上所述是小編給大家介紹的Mybtis 傳輸List的實現(xiàn)代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對創(chuàng)新互聯(lián)網(wǎng)站的支持!

當前名稱:Mybatis傳輸List的實現(xiàn)代碼
文章地址:http://jinyejixie.com/article46/pocgeg.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、關鍵詞優(yōu)化標簽優(yōu)化、品牌網(wǎng)站設計虛擬主機、企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站
襄汾县| 大港区| 涞源县| 舞阳县| 临西县| 博兴县| 甘洛县| 大埔区| 泽普县| 大姚县| 兰溪市| 玉屏| 大埔区| 辛集市| 荥经县| 婺源县| 陈巴尔虎旗| 汉川市| 牡丹江市| 博兴县| 汉沽区| 郸城县| 武强县| 靖边县| 西贡区| 睢宁县| 襄樊市| 泸定县| 伊宁县| 成安县| 泽州县| 沧源| 盘锦市| 博罗县| 江陵县| 弥渡县| 桐柏县| 常熟市| 涿鹿县| 广州市| 潍坊市|