Mybatis 动态插入 Lista 的实例代码如下所述:
<insert id="savePrpcitemkindList" parameterType="java.util.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) <foreach collection = "list" itens = "itens" Índice "" Separator = "união"> <TRIM> < -TRIMEIXIXIXX = "List" = "Index =" Index "" Union = "união" test = "item.RiskCode! = null">#{item.riskcode}, </when> <caso contrário, null, </nocros> </escolha> <escolha> <quando test = "item.itemkindno! null ">#{item.familyno}, </when> <bote> null, </bonsion> </fiar> <escolha> <quando test =" item.familyName! null ">#{item.ProjectCode}, </quando> <bem> null, </bonsion> </fiar> <escolha> <quando test =" item.clausecode! = null ">#{item.clauseCode}, </nen> <bem> null, </none> </escolhido> <quando testes =", ", </when> <bem> null, </none> </escolhido> <quando testes <hen-bode =", </when> <bem> null, </none> </escolhido> <quando null ">#{item.claUseName}, </when> <bem> null, </bonsion> </fiar> <escolha> <quando test =" item.kindcode! = null ">#{item.kindcode}, </quando> <bem> null, </SUMA> </fothe> <fothcode}, item </when> <bone> null, </SUMA> </fothe> <fothe> <quando =} ".kyn, </quando> <bem> null, </si mesmo> </escolha> <fothe> <quando =} ".kyn, </when> <bem> null, </sumo> </escolha> <fulher> <quando =}". null ">#{item.kindname}, </when> <botero> null, </si mesmo> </fiar> <fice> <when test =" item.itemno! = null ">#{item.itemno}, </quando> </senão> null, </nagro> </escolha> <escolha> <quando testes = ".item.itcode! null ">#{item.itemcode}, </quando> <caso contrário, null, </si mesmo> </fiar> <escolha> <Quando test =" item.iTemDetailName! = null ">#{item.itemDetailName}, </quando> <btro> null, </outros> </escolhido> <escolha> <archname}, </quando> <btro>, </outros> </escolhido> <archName}, </when> <de outra forma> null ">#{item.groupno}, </when> <caso contrário, null, </nocros> </fiar> <escolha> <quando test =" item.modecode! = null ">#{item.modecode}, </quando> <bem> null, </nagro> </foth> <escolha> <quando = item.moden! null ">#{item.modename}, </when> <caso contrário, null, </bonsion> </fiar> <escolha> <quando test =" item.startdate! = null ">#{item.startdate}, </when> <bem> null, </nagro> </foth> <fice> <when-tem.starth! null ">#{item.starthour}, </when> <caso contrário, null, </nocros> </fiar> <fice> <when test =" item.enddate! = null ">#{item.enddate}, </quando> </senão> null, </nagro> </escolha> <escolha> <quando), </quando> </senão> null, </nages> </escolha> <preegram> <quando =". null ">#{item.endhour}, </quando> <caso contrário, null, </nocros> </fiar> <fice> <quando test =" item.model! = null ">#{item.model}, </quando> </senão> null, </outro null ">#{item.buydate}, </when> <bem> null, </bonsion> </fiar> <escolha> <when test =" item.addressno! = null ">#{item.addressno}, </when> <bem> null, </outros> </escolhido> <quando testes =", ", </quando> </null, </outro> </escolhido> <quando testes =", ", </quando> <bem> null, </outro> </escolhido> <quando testes =". null ">#{item.calculateflag}, </when> <bem> null, </bonsion> </fiar> <escolha> <quando test =" item.currency! = null ">#{item.currency}, </when> <bem> null, </nagro> </escolha> <COHTU> <quando = item.In. null ">#{item.unitamount}, </when> <caso contrário, null, </bonsion> </fiar> <escolha> <quando test =" item.quantity! = null ">#{item.quantity}, </quando> </senão> null, </de outra forma </escolhido> <prety> <quando}, item.it! null ">#{item.unit}, </quando> <caso contrário, null, </bonsion> </escolha> <escolha> <quando test =" item.value! = null ">#{item.value}, </quando> <bem> null, </bonsion> <//escolha> <escolha> <quando teste =" item.Amount! null ">#{item.amount}, </when> <caso contrário, null, </nocros> </escolha> <escolha> <quando test =" item.ratePeriod! = null ">#{item.ratePeriod}, </quando> <bem> null, </nocros> </foth> <fothe> <quando}, item </quando> <btro>, </de outra forma </escolha> <fulher> <quando = ".rtlerate! null ">#{item.rate}, </when> <caso contrário, null, </nocros> </fiar> <escolha> <Quando test =" item.shortrateflag! = null ">#{item.shortrateflag}, </ning> <bem> null, </outra null ">#{item.shortrate}, </when> <caso contrário, null, </bonsion> </fiar> <escolha> <Quando test =" item.prepremium! = null ">#{item.prepremium}, </when> <bem> null, </outro> </escolhido> <escolha> <when} ".l item) null ">#{item.calPremium}, </quando> <bem> null, </bonsion> </fiar> <escolha> <quando test =" item.basePremium! = null ">#{item.basepremium}, </nlehan </outro null, </outro> </escolhido> <quando testes}". null ">#{item.benchmarkPremium}, </when> <bem> null, </si mesmo> </fiar> <escolha> <when test =" item.discount! = null ">#{item.discount}, </when> <bem> null, </nagro> </fothe> <escolha> <quando = item. null ">#{item.adjustrate}, </when> <caso contrário, null, </bonsion> </escolha> <escolha> <quando test =" item.UnitPremium! = null ">#{item.unitPremium}, </when> <bem> null, </Secheme> </escolha> <the> <quando testes =}". null ">#{item.premium}, </quando> <caso contrário, null, </nocros> </fiar> <fice> <quando test =" item.deductiblate! = null ">#{item.deductiBlate}, </when> <bem> null, </stone> </fotion> <fice> <quando}". null ">#{item.deductible}, </quando> <caso contrário, null, </nocros> </fiar> <fice> <Quando test =" item.flag! = null ">#{item.flag}, </quando> <bem> null, </outro null">#{item.inserttimeforhis},</when><otherwise>null,</otherwise></choose><choose><when test="item.operatetimeforhis != null">#{item.operatetimeforhis},</when><otherwise>null,</otherwise></choose><choose><when test="item.taxrate != null ">#{item.taxrate}, </when> <caso contrário, null, </nocros> </fiar> <fice> <Quando test =" item.taxflag! = null ">#{item.taxflag}, </quando> <bem> null, </nocros> </foth> <escolha> <when" null ">#{item.taxfee}, </when> <bone> null, </bonsion> </fiar> <escolha> <quando test =" item.netPremium! = null ">#{item.netPremium}, </1 when> <bem> null, </outro> </escolhido> <thee> <when}". null ">#{item.taxfee_gb}, </when> <bem> null, </bonsion> </escolha> <escolha> <quando test =" item.taxfee_lb! = null ">#{item.taxfee_lb}, </quando> <bem> null, <//. null ">#{item.alltaxfee}, </when> <bote> null, </nocros> </escolha> <escolha> <Quando test =" item.allNetPremium! = null ">#{item.allNeTPremium}, </when> <bem> null, </nofir> </escolhido> {item {Itement}, </when> <bem> null, <///</escolha> {{{Mybatis 传入 Lista 参数的实例代码如下所述:
Java 代码
// dao 代码 如果传入的参数是数组 , 也一样 void InsertDefaultMSG (@param ("idslist") ArrayList <String> idslist); // xml 文件 <update id = "insertDefaultMsg" parametertype = "java.util.list"> atualizar plf_pur_delivery_plan p set p.promise_delivery_amount = p.quantity_req, p.promise_delivery_time = p.quantity_time onde Open = "(" Close = ")" index = ""> #{item, jdbctype = varchar} </foreach> </atualize> // 如果传入字符串 // Service 代码 map <string, string> map = bean.getDatas (). get (0); String ids = map.get ("ids"); String [] idSarr = ids.split (","); String inid = ""; para (int i = 0; i <idsarr.length; i ++) {if (i! = idsarr.length - 1) {inid += "'" +idsarr [i] +"',"; } else {inid + = "'" + idSarr [i] + "'"; }} List <map <string, string >> list = purdeliveryPlandao .getPlanListManual (inid); // dao 层代码 lista <map <string, string >> getPlanListManual (@param ("inid") string inid); // xml 文件 <select id = "getPlanListManual" parameterType = "java.lang.string" resultType = "java.util.map"> selecione P.Supplier_code, p.pur_order_no, if (p.update_tEs> 0, '修改订单' '') p.is_noTice = '0' e p.is_delete = '1' e p.id in (<! [CDATA [$ {inid}]]>) Grupo por p.supplier_code, p.pur_order_no.总结
以上所述是小编给大家介绍的 mybatis 动态插入 lista 传入 lista 参数的实例代码 , 希望对大家有所帮助 , 如果大家有任何疑问欢迎给我留言 , 小编会及时回复大家的!