小編給大家分享一下mybatis動態(tài)插入list傳入List參數(shù)的示例分析,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計,成都做網(wǎng)站公司-創(chuàng)新互聯(lián)已向數(shù)千家企業(yè)提供了,網(wǎng)站設(shè)計,網(wǎng)站制作,網(wǎng)絡(luò)營銷等服務(wù)!設(shè)計與技術(shù)結(jié)合,多年網(wǎng)站推廣經(jīng)驗,合理的價格為您打造企業(yè)品質(zhì)網(wǎng)站。mybatis動態(tài)插入list的實例代碼如下所述:
insert into prpcitemkind (RISKCODE, ITEMKINDNO, FAMILYNO, FAMILYNAME, PROJECTCODE, CLAUSECODE, CLAUSENAME, KINDCODE, KINDNAME, ITEMNO, ITEMCODE, ITEMDETAILNAME, GROUPNO, MODECODE, MODENAME, STARTDATE, STARTHOUR, ENDDATE, ENDHOUR, MODEL, BUYDATE, ADDRESSNO, CALCULATEFLAG, CURRENCY, UNITAMOUNT, QUANTITY, UNIT, VALUE, AMOUNT, RATEPERIOD, RATE, SHORTRATEFLAG, SHORTRATE, PREPREMIUM, CALPREMIUM, BASEPREMIUM, BENCHMARKPREMIUM, DISCOUNT, ADJUSTRATE, UNITPREMIUM, PREMIUM, DEDUCTIBLERATE, DEDUCTIBLE, FLAG, INSERTTIMEFORHIS, OPERATETIMEFORHIS, TAXRATE, TAXFLAG, TAXFEE, NETPREMIUM, TAXFEE_GB, TAXFEE_LB, ALLTAXFEE, ALLNETPREMIUM,PROPOSALNO) #{item.riskcode}, null, #{item.itemkindno}, null, #{item.familyno}, null, #{item.familyname}, null, #{item.projectcode}, null, #{item.clausecode}, null, #{item.clausename}, null, #{item.kindcode}, null, #{item.kindname}, null, #{item.itemno}, null, #{item.itemcode}, null, #{item.itemdetailname}, null, #{item.groupno}, null, #{item.modecode}, null, #{item.modename}, null, #{item.startdate}, null, #{item.starthour}, null, #{item.enddate}, null, #{item.endhour}, null, #{item.model}, null, #{item.buydate}, null, #{item.addressno}, null, #{item.calculateflag}, null, #{item.currency}, null, #{item.unitamount}, null, #{item.quantity}, null, #{item.unit}, null, #{item.value}, null, #{item.amount}, null, #{item.rateperiod}, null, #{item.rate}, null, #{item.shortrateflag}, null, #{item.shortrate}, null, #{item.prepremium}, null, #{item.calpremium}, null, #{item.basepremium}, null, #{item.benchmarkpremium}, null, #{item.discount}, null, #{item.adjustrate}, null, #{item.unitpremium}, null, #{item.premium}, null, #{item.deductiblerate}, null, #{item.deductible}, null, #{item.flag}, null, #{item.inserttimeforhis}, null, #{item.operatetimeforhis}, null, #{item.taxrate}, null, #{item.taxflag}, null, #{item.taxfee}, null, #{item.netpremium}, null, #{item.taxfee_gb}, null, #{item.taxfee_lb}, null, #{item.alltaxfee}, null, #{item.proposalno} #{item.allnetpremium}, null,
Mybatis 傳入List參數(shù)的實例代碼如下所述:
Java代碼
//dao 代碼 如果傳入的參數(shù)是數(shù)組,也一樣 void insertDefaultMsg(@Param("idsList") ArrayListidsList); //xml文件 UPDATE plf_pur_delivery_plan p SET p.promise_delivery_amount = p.quantity_req, p.promise_delivery_time = p.quantity_time WHERE p.id IN //如果傳入字符串 //service 代碼 Map#{item, jdbcType=VARCHAR} map = bean.getDatas().get(0); String ids = map.get("ids"); String[] idsArr = ids.split(","); String inId = ""; for (int i = 0; i < idsArr.length; i++) { if (i != idsArr.length - 1) { inId += "'" + idsArr[i] + "',"; } else { inId += "'" + idsArr[i] + "'"; } } List
以上是“mybatis動態(tài)插入list傳入List參數(shù)的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!