mybatis 动态插入 daftar 的实例代码如下所述 :
<masukkan id = "savePrpCitemKindlist" parameTerType = "java.util.list"> masukkan ke prpcitemkind (RisikoCode, itemKindno, familyno, familyname, projectcode, clauseCode, clausename, cindCode, KindName, itemno, itemcode, itemCode, 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, Proposal tidak ada <Foreach Collection = "Daftar" item = "item" index = "index" pemisah "=" Union All "<Foreach Collection =" Item = "item" index = "index" pemisah "=" Union all "<Foreach collection =" item = "item" index = "index" pemisah "=" Union all " test = "item.RiskCode! = null">#{item.RiskCode}, </kapuk -usul> <kalau nol, </sebaliknya> </pilih> <pilih> <when test = "item.itemkindno! = null"> {item.itemkindno}, </whow> </whow> </null, <//{item.itemkindno}, </whow> </whane> </null, null, <///{item.itemkindno}, </whow> </whane> nulling> null, </null, </null, </nulling> </whow a null ' null ">#{item.familyno}, </when> <kalau null, </serpondany null ">#{item.projectCode}, </when> <kalau null, </serpondany null ">#{item.clausename}, </when> <nergonden> null, </kinger> </clote> <toto> <when test =" item.kindcode! = null ">#{item.kindcode}, </when> <daes> null, </sebaliknya> </pilih> <poing> when test =" null ">#{item.kindname}, </when> <kalau tidak> null, </sebaliknya> </toCh> <toFer> <when test =" item.itemno! = null ">#{item.itemno}, </kapangan> <sebaliknya> null, </poing> </pilih> <pilih> <when test =" itemc.itemc. null ">#{item.itemCode}, </when> <kalau tidak> null, </sebaliknya> </pilih> <pilih> <when test =" item.itemdetailname! = null ">#{item.itemdetailName}, </whoeD =" null, </{{{pilih> </whene </whene = " null ">#{item.groupno}, </when> <kalau tidak> null, </sebaliknya> </toCh> <toFer> <when test =" item.modecode! = null ">#{item.modecode}, </when> <serama> null, </sebaliknya> </pilih> <pilih> <When test =" item.mod.mod, sebaliknya> null, </sebaliknya> </pilih> <pilih> <When test = " null ">#{item.modename}, </when> <kalau null, </serpondany null ">#{item.starthour}, </when> <kalau tidak> null, </sebaliknya> </toCh> <toFer> <when test =" item.endDate! = null ">#{item.endDate}, </kapangan> <serponde> null, </piling> </pilih> <pilih> <when test =" endseRour! null ">#{item.endHour}, </when> <nerdaes> null, </corde> </touct> <toFer> <when test =" item.model! = null ">#{item.model}, </kapangan> <sebaliknya> null, </poing> </pilih> <pilih> <when test =" iting.buyeT> null ">#{item.buydate}, </when> <kalau null, </sefely> </touch> <touct> <when test =" item.addressno! = null ">#{item.addressno}, </kap null ">#{item.calculateFlag}, </when> <kalau null, </serponden> </touct> <pilih> <when test =" item.currency! = null ">#{item.currency}, </when> <serponder> null, </sebaliknya> </pilih> <pilih> when test =" null ">#{item.unitamount}, </when> <kalau tidak> null, </sebaliknya> </toCh> <pilih> <when test =" item.quantity! = null ">#{item.quantity}, </whow> <serama> null, </poing> </pilih> <pilih> <whene test =" null! null ">#{item.unit}, </when> <kingh null, </serponden> </touct> <poing> <when test =" item.value! = null ">#{item.value}, </kapangan> </sebaliknya null, </poing> </pilih> <pilih> <when test =" itemount! null ">#{item.amount}, </when> <kalau null, </sefely> </tibel> <pilih> <when test =" item.rateperiod! = null ">#{item.rateperiod}, </kapangan> <sebaliknya> null, </sebaliknya> </pilih> <pilih> <when test =" item.RATE! null ">#{item.rate}, </when> <kalau nol null, </sefely> </tibel> <pilih> <when test =" item.shortrateFlag! = null ">#{item.shortrateFlag}, </when> <daes> null, </sebaliknya> </pilih> <pilih> when test =" null ">#{item.shortrate}, </when> <kalau null, </sefely> </touct> <poing> <when test =" item.prepremium! = null ">#{item.prepremium}, </whow> <daes> null, </sebaliknya> </pilih> <poing> <When test =" null ">#{item.calpremium}, </whow> <nergonden> null, </serponden> </touct> <touct> <when test =" item.basepremium! = null ">#{item.basepremium}, </whening> <daes> null, </sebaliknya> </pilih> <pilih> <whane =" null, </sebaliknya> </pilih> <pilih> <whane = "null, null, </ancte> </pilih> <pilih> <whene =" null, null, </ancte> </pilih </choose> <whene = "null, </ancte> </pilih> <choose> <when uji =" null, null, </ancerte> </angkat </pilih> <whene = "nullpark. null ">#{item.benchmarkPremium}, </when> <kalau null, </angkataian> </pilih> <pilih> <when test =" item.discount! = null ">#{item.discount}, </when> <daes> null, </order> </cikta> <pilih> <when test =" item.ade.ade, null, </sebaliknya> </pilih> <pilih> <when test = "item.ade.ade.ade, null, </sebaliknya> </pilih> <pilih> <When test =" item.ade.ade.ade, null, </alipau null ">#{item.adjustrate}, </when> <kalau null, </serpondany null ">#{item.premium}, </when> <kalau tidak> null, </sebaliknya> </to. null ">#{item.deductible}, </when> <kingher> null, </angkataian> </to. null ">#{item.insertTimeforhis}, </when> <kalau tidak> null, </sebaliknya> </toCh> <pilih> <when test =" item.operatetimeforhis! = null ">#{item.operateMeForHis}, </whow> <kerana> <sebaliknya> </sebaliknya>! null ">#{item.taxrate}, </when> <kalau null, </serpondany null ">#{item.taxfee}, </when> <kalau> null, </serpondany null ">#{item.taxfee_gb}, </when> <kalau> null, </sefely> </touct> <touct> <when test =" item.taxfee_lb! = null ">#{item.taxfee_lb}, </whow> <serama null, null, </sebaliknya> </pilih> ="} </whower </whower </null, </{sebaliknya> </choote> = "} </whower </null null, </{{{//choote </aTaller> =" </who test = null, </{{//choose> pilih = " null ">#{item.alltaxfee}, </when> <serembua> null, </serponden> </toch> <touct> <when test =" item.allnetpremium! = null ">#{item.allnetpremium}, </whene> null, </{sebaliknya> </pilih> {item.pop.pop.Mybatis 传入 daftar 参数的实例代码如下所述 :
Java 代码
// dao 代码 如果传入的参数是数组 , 也一样 void insertDefaultmsg (@param ("idslist") arraylist <string> idslist); //xml文件 <update id="insertDefaultMsg" parameterType="java.util.List"> 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 <foreach item="item" collection="idsList" separator="," open = "(" close = ")" index = ""> #{item, jdbctype = varchar} </tandingeach> </dendate> // 如果传入字符串 // service 代码 peta <string, string> peta = bean.getDatas (). get (0); String ids = map.get ("ids"); String [] idSarr = ids.split (","); String inid = ""; untuk (int i = 0; i <idSarr.length; i ++) {if (i! = idSarr.length - 1) {inid += "'" +idSarr [i] +"',"; } else {inid + = "'" + idSarr [i] + "'"; }} Daftar <peta <string, string >> list = purdeliveryplandao .getplanlistManual (inid); // dao 层代码 daftar <peta <string, string >> getplanlistManual (@param ("inid") string inid); // xml 文件 <pilih id = "getplanlistManual" parameTerType = "java.lang.string" resultType = "java.util.map"> pilih p.supplier_code, p.pur_order_no, if (p.update_times> 0, '修改订单', '新订单'), if (p.update_times> 0, '修改订单', '新订单') p.is_notice = '0' dan p.is_delete = '1' dan p.id in (<! [cdata [$ {inid}]]>) grup oleh p.supplier_code, p.pur_order_no order oleh p.supplier_code </pilih>总结
以上所述是小编给大家介绍的 mybatis 动态插入 daftar 传入 daftar 参数的实例代码 , 希望对大家有所帮助 , 如果大家有任何疑问欢迎给我留言 , 小编会及时回复大家的!