zoukankan      html  css  js  c++  java
  • mybatis 注解写法 多层嵌套foreach,调用存储过程,批量插入数据

     1    @Select("<script>" +
     2   "DECLARE @edi_Invoice_Details edi_Invoice_Details;" +
     3   "DECLARE @edi_Invoice_OrderItem edi_Invoice_OrderItem;" +
     4 
     5   "INSERT INTO @edi_Invoice_Details (" +
     6    "oldso,so,po,invoiceTaxNo,invoiceType,invoiceTitle,
    " +
     7    "invoiceAddress,invoiceState,invoiceTaxRate,invoiceContent,
    " +
     8    "invoiceRatePrice,invoiceNoTaxPrice,invoiceId,invoiceDate,invoiceTaxPrice,invoiceNO,invoiceCode" +
     9    " ) " +
    10    "VALUES " +
    11    "<foreach collection="ediInvoiceDetails" item="ediInvoiceDetail" index="index" separator="," close=";">" +
    12    "( " +
    13      "#{ediInvoiceDetail.oldso},#{ediInvoiceDetail.so},#{ediInvoiceDetail.po},#{ediInvoiceDetail.invoiceTaxNo},#{ediInvoiceDetail.invoiceType},#{ediInvoiceDetail.invoiceTitle}," +
    14      "#{ediInvoiceDetail.invoiceAddress},#{ediInvoiceDetail.invoiceState},#{ediInvoiceDetail.invoiceTaxRate},#{ediInvoiceDetail.invoiceContent},#{ediInvoiceDetail.invoiceRatePrice}," +
    15      "#{ediInvoiceDetail.invoiceNoTaxPrice},#{ediInvoiceDetail.invoiceId},CONVERT(DATETIME,#{ediInvoiceDetail.invoiceDate},105),#{ediInvoiceDetail.invoiceTaxPrice},"+
    16      "#{ediInvoiceDetail.invoiceNO},#{ediInvoiceDetail.invoiceCode}"+
    17     " )" +
    18      "</foreach> " +
    19      "<foreach collection="ediInvoiceDetails" item="ediInvoiceDetail" index="index" open="begin" close=";end;" separator=";">" +
    20      "INSERT INTO @edi_Invoice_OrderItem ( " +
    21      "invoiceDetailsId, so, bomCode, agreementPrice,productAmount, productName " +
    22      ") " +
    23      "VALUES " +
    24 
    25      "<foreach collection="ediInvoiceDetail.sodetails" item="sodetail" index="index" separator=",">( " +
    26       "#{sodetail.invoiceDetailsId},#{sodetail.so},#{sodetail.bomCode},#{sodetail.agreementPrice},#{sodetail.productAmount},#{sodetail.productName} "+
    27       " )</foreach></foreach> " +
    28 
    29      "EXEC up_EDI_Sync_SaveEDIInvoiceDetails @edi_Invoice_Details,@edi_Invoice_OrderItem"+
    30     "</script>")
    31     @Options(statementType = StatementType.CALLABLE)
    32     void saveEdiInvoiceDetails(@Param("ediInvoiceDetails") List<EDIInvoiceDetails> ediInvoiceDetails);

     

  • 相关阅读:
    选择Nodejs的N个理由
    linux下查看内存的命令
    Nginx反向代理和负载均衡部署指南
    linux下创建,删除,移动文件命令
    linux文件创建、查看、编辑命令
    Linux下rar命令详解
    linux下tar命令详解
    linux下使用tar命令
    Eclispe怎么给工作空间下的项目分组
    MAT(Memory Analyzer Tool)工具入门介绍
  • 原文地址:https://www.cnblogs.com/sbk613/p/10894909.html
Copyright © 2011-2022 走看看