国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > Java > 正文

mybatis動(dòng)態(tài)插入list傳入List參數(shù)的實(shí)例代碼

2024-07-14 08:40:17
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

mybatis動(dòng)態(tài)插入list的實(shí)例代碼如下所述:

 

<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" item="item" index="index" separator="union all"><trim prefix="select" suffix="from dual"><choose><when test="item.riskcode != null">#{item.riskcode},</when><otherwise>null,</otherwise></choose><choose><when test="item.itemkindno != null">#{item.itemkindno},</when><otherwise>null,</otherwise></choose><choose><when test="item.familyno != null">#{item.familyno},</when><otherwise>null,</otherwise></choose><choose><when test="item.familyname != null">#{item.familyname},</when><otherwise>null,</otherwise></choose><choose><when test="item.projectcode != null">#{item.projectcode},</when><otherwise>null,</otherwise></choose><choose><when test="item.clausecode != null">#{item.clausecode},</when><otherwise>null,</otherwise></choose><choose><when test="item.clausename != null">#{item.clausename},</when><otherwise>null,</otherwise></choose><choose><when test="item.kindcode != null">#{item.kindcode},</when><otherwise>null,</otherwise></choose><choose><when test="item.kindname != null">#{item.kindname},</when><otherwise>null,</otherwise></choose><choose><when test="item.itemno != null">#{item.itemno},</when><otherwise>null,</otherwise></choose><choose><when test="item.itemcode != null">#{item.itemcode},</when><otherwise>null,</otherwise></choose><choose><when test="item.itemdetailname != null">#{item.itemdetailname},</when><otherwise>null,</otherwise></choose><choose><when test="item.groupno != null">#{item.groupno},</when><otherwise>null,</otherwise></choose><choose><when test="item.modecode != null">#{item.modecode},</when><otherwise>null,</otherwise></choose><choose><when test="item.modename != null">#{item.modename},</when><otherwise>null,</otherwise></choose><choose><when test="item.startdate != null">#{item.startdate},</when><otherwise>null,</otherwise></choose><choose><when test="item.starthour != null">#{item.starthour},</when><otherwise>null,</otherwise></choose><choose><when test="item.enddate != null">#{item.enddate},</when><otherwise>null,</otherwise></choose><choose><when test="item.endhour != null">#{item.endhour},</when><otherwise>null,</otherwise></choose><choose><when test="item.model != null">#{item.model},</when><otherwise>null,</otherwise></choose><choose><when test="item.buydate != null">#{item.buydate},</when><otherwise>null,</otherwise></choose><choose><when test="item.addressno != null">#{item.addressno},</when><otherwise>null,</otherwise></choose><choose><when test="item.calculateflag != null">#{item.calculateflag},</when><otherwise>null,</otherwise></choose><choose><when test="item.currency != null">#{item.currency},</when><otherwise>null,</otherwise></choose><choose><when test="item.unitamount != null">#{item.unitamount},</when><otherwise>null,</otherwise></choose><choose><when test="item.quantity != null">#{item.quantity},</when><otherwise>null,</otherwise></choose><choose><when test="item.unit != null">#{item.unit},</when><otherwise>null,</otherwise></choose><choose><when test="item.value != null">#{item.value},</when><otherwise>null,</otherwise></choose><choose><when test="item.amount != null">#{item.amount},</when><otherwise>null,</otherwise></choose><choose><when test="item.rateperiod != null">#{item.rateperiod},</when><otherwise>null,</otherwise></choose><choose><when test="item.rate != null">#{item.rate},</when><otherwise>null,</otherwise></choose><choose><when test="item.shortrateflag != null">#{item.shortrateflag},</when><otherwise>null,</otherwise></choose><choose><when test="item.shortrate != null">#{item.shortrate},</when><otherwise>null,</otherwise></choose><choose><when test="item.prepremium != null">#{item.prepremium},</when><otherwise>null,</otherwise></choose><choose><when test="item.calpremium != null">#{item.calpremium},</when><otherwise>null,</otherwise></choose><choose><when test="item.basepremium != null">#{item.basepremium},</when><otherwise>null,</otherwise></choose><choose><when test="item.benchmarkpremium != null">#{item.benchmarkpremium},</when><otherwise>null,</otherwise></choose><choose><when test="item.discount != null">#{item.discount},</when><otherwise>null,</otherwise></choose><choose><when test="item.adjustrate != null">#{item.adjustrate},</when><otherwise>null,</otherwise></choose><choose><when test="item.unitpremium != null">#{item.unitpremium},</when><otherwise>null,</otherwise></choose><choose><when test="item.premium != null">#{item.premium},</when><otherwise>null,</otherwise></choose><choose><when test="item.deductiblerate != null">#{item.deductiblerate},</when><otherwise>null,</otherwise></choose><choose><when test="item.deductible != null">#{item.deductible},</when><otherwise>null,</otherwise></choose><choose><when test="item.flag != null">#{item.flag},</when><otherwise>null,</otherwise></choose><choose><when test="item.inserttimeforhis != 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><otherwise>null,</otherwise></choose><choose><when test="item.taxflag != null">#{item.taxflag},</when><otherwise>null,</otherwise></choose><choose><when test="item.taxfee != null">#{item.taxfee},</when><otherwise>null,</otherwise></choose><choose><when test="item.netpremium != null">#{item.netpremium},</when><otherwise>null,</otherwise></choose><choose><when test="item.taxfee_gb != null">#{item.taxfee_gb},</when><otherwise>null,</otherwise></choose><choose><when test="item.taxfee_lb != null">#{item.taxfee_lb},</when><otherwise>null,</otherwise></choose><choose><when test="item.alltaxfee != null">#{item.alltaxfee},</when><otherwise>null,</otherwise></choose><choose><when test="item.allnetpremium != null">#{item.allnetpremium},</when><otherwise>null,</otherwise></choose>#{item.proposalno}</trim></foreach>  </insert>

Mybatis 傳入List參數(shù)的實(shí)例代碼如下所述:

Java代碼

//dao 代碼 如果傳入的參數(shù)是數(shù)組,也一樣 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}      </foreach>    </update> //如果傳入字符串 //service 代碼 Map<String, String> 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<Map<String, String>> list = purDeliveryPlanDao         .getPlanListManual(inId); //dao層代碼 List<Map<String, String>> getPlanListManual(@Param("inId") String inId); //xml 文件 <select id="getPlanListManual" parameterType="java.lang.String" resultType="java.util.Map">     SELECT       p.supplier_code,      p.pur_order_no,      IF(       p.update_times > 0,       '修改訂單',       '新訂單'      ) AS order_type      FROM      plf_pur_delivery_plan p      WHERE p.is_notice = '0'       AND p.is_delete = '1'       AND p.id in(<![CDATA[${inId}]]>)     GROUP BY p.supplier_code,      p.pur_order_no      ORDER BY p.supplier_code    </select> 

總結(jié)

以上所述是小編給大家介紹的mybatis動(dòng)態(tài)插入list傳入List參數(shù)的實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到JAVA教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 宕昌县| 齐河县| 封丘县| 柘荣县| 漯河市| 永胜县| 淮滨县| 互助| 巩义市| 黑水县| 鹤山市| 林甸县| 武城县| 牟定县| 嫩江县| 眉山市| 房产| 读书| 青铜峡市| 泉州市| 潼关县| 漯河市| 吉首市| 西藏| 南平市| 南岸区| 府谷县| 黄大仙区| 泗洪县| 宜丰县| 寿宁县| 额济纳旗| 青阳县| 岳阳县| 哈尔滨市| 前郭尔| 胶南市| 于都县| 松滋市| 丰顺县| 平湖市|