最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2018年04月21日 13:43:27   投稿:mrr  
本文通過實(shí)例代碼給大家介紹了mybatis動(dòng)態(tài)插入list,Mybatis 傳入List參數(shù)的方法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧

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ì)大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!

相關(guān)文章

  • Java并發(fā)編程之ReentrantLock可重入鎖的實(shí)例代碼

    Java并發(fā)編程之ReentrantLock可重入鎖的實(shí)例代碼

    這篇文章主要介紹了Java并發(fā)編程之ReentrantLock可重入鎖的實(shí)例代碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-02-02
  • Java用正則表達(dá)式實(shí)現(xiàn)${name}形式的字符串模板實(shí)例

    Java用正則表達(dá)式實(shí)現(xiàn)${name}形式的字符串模板實(shí)例

    這篇文章主要給大家介紹了Java如何用正則表達(dá)式實(shí)現(xiàn)${name}形式的字符串模板,文章給出詳細(xì)的實(shí)例代碼,對(duì)大家的理解和學(xué)習(xí)會(huì)很有幫助,有需要的朋友們下面來一起看看吧。
    2016-12-12
  • java多線程創(chuàng)建及線程安全詳解

    java多線程創(chuàng)建及線程安全詳解

    多線程是日常開發(fā)中的常用知識(shí),也是難用知識(shí)。通這篇文章主要給大家介紹了關(guān)于java多線程創(chuàng)建及線程安全的相關(guān)資料,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-05-05
  • spring-retry組件的使用教程

    spring-retry組件的使用教程

    Spring Retry的主要目的是為了提高系統(tǒng)的可靠性和容錯(cuò)性,當(dāng)方法調(diào)用失敗時(shí),Spring Retry可以在不影響系統(tǒng)性能的情況下,自動(dòng)進(jìn)行重試,從而減少故障對(duì)系統(tǒng)的影響,這篇文章主要介紹了spring-retry組件的使用,需要的朋友可以參考下
    2023-06-06
  • Netty學(xué)習(xí)教程之Netty與Marshalling結(jié)合發(fā)送對(duì)象

    Netty學(xué)習(xí)教程之Netty與Marshalling結(jié)合發(fā)送對(duì)象

    Netty是由JBOSS提供的一個(gè)Java開源框架,之前已經(jīng)給大家簡(jiǎn)單介紹了一些基礎(chǔ)與使用,下面這篇文章主要給大家介紹了關(guān)于Netty與Marshalling結(jié)合發(fā)送對(duì)象的相關(guān)資料,需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-05-05
  • 如何在Spring boot加入shiro支持

    如何在Spring boot加入shiro支持

    這篇文章主要介紹了如何在Spring boot加入shiro支持,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-12-12
  • Java中的共享鎖CountDownLatch及源碼解析

    Java中的共享鎖CountDownLatch及源碼解析

    這篇文章主要介紹了Java中的共享鎖CountDownLatch及源碼解析,CountDownLatch是一種同步輔助工具,允許一個(gè)或多個(gè)線程等待,直到在其它線程中執(zhí)行的一組操作完成;CountDownLatch使用指定的計(jì)數(shù)初始化,需要的朋友可以參考下
    2023-11-11
  • Spring中的singleton和prototype的實(shí)現(xiàn)

    Spring中的singleton和prototype的實(shí)現(xiàn)

    這篇文章主要介紹了Spring中的singleton和prototype的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-07-07
  • SpringMVC中的請(qǐng)求參數(shù)接收方式

    SpringMVC中的請(qǐng)求參數(shù)接收方式

    這篇文章主要介紹了SpringMVC中的請(qǐng)求參數(shù)接收方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2025-04-04
  • Java+OpenCV實(shí)現(xiàn)人臉檢測(cè)并自動(dòng)拍照

    Java+OpenCV實(shí)現(xiàn)人臉檢測(cè)并自動(dòng)拍照

    這篇文章主要為大家詳細(xì)介紹了Java+OpenCV實(shí)現(xiàn)人臉檢測(cè),并調(diào)用筆記本攝像頭實(shí)時(shí)抓拍,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-07-07

最新評(píng)論

垦利县| 含山县| 元谋县| 岱山县| 丹江口市| 家居| 麻城市| 凤凰县| 隆昌县| 镇雄县| 武穴市| 荃湾区| 肃南| 宜君县| 本溪| 长岭县| 桃园县| 元朗区| 垣曲县| 军事| 仁怀市| 兰州市| 清新县| 竹北市| 抚顺市| 江陵县| 同心县| 宁陵县| 叶城县| 宜都市| 新田县| 双柏县| 曲松县| 正蓝旗| 平山县| 华池县| 宁陵县| 齐齐哈尔市| 离岛区| 大渡口区| 石嘴山市|