zoukankan      html  css  js  c++  java
  • SSM批量插入和修改实现实例

    1.Service,自己对代码逻辑进行相应处理

     1 /* 新增订单产品信息 */
     2         List<DmsOrderProduct> insertOrderProductList = Lists.newArrayList();
     3         for (DmsOrderProductVo op : orderVo.getProductList()) {
     4             insertOrderProductList.add(op);
     5         }
     6 
     7         /* 批量新增订单商品信息 */
     8         if (!insertOrderProductList.isEmpty()) {
     9             dmsOrderProductService.batchInsert(insertOrderProductList);
    10         }
    没写接口,自己处理下
    1
    @Override 2 public void batchInsert(List<DmsOrderProduct> orderProductList) { 3 dmsOrderProductMapper.batchInsert(orderProductList); 4 }

    2.持久层

    1  /**
    2      * 批量新增订单产品信息
    3      * @param orderProductList
    4      */
    5     void batchInsert(List<DmsOrderProduct> orderProductList);
     1 <!-- 批量新增订单产品信息 -->
     2   <insert id="batchInsert" parameterType="java.util.List">
     3     insert into dms_order_product
     4     (
     5       order_id, product_id, product_code, product_name, product_spec_id, spec_union_key, shoppingcart_id, unit, original_price,
     6       price, count, return_count, status, promotion_product_id, promotion_subject, created_date, created_by,
     7       last_updated_date, last_updated_by, remove_flag, weight, volume, short_name, spec_name
     8     )
     9     values
    10     <foreach collection="list" index="index" item="item" separator=",">
    11       (
    12         #{item.orderId}, #{item.productId}, #{item.productCode}, #{item.productName}, #{item.productSpecId},
    13         #{item.specUnionKey},#{item.shoppingcartId}, #{item.unit}, #{item.originalPrice}, #{item.price}, #{item.count},
    14         #{item.returnCount}, #{item.status}, #{item.promotionProductId}, #{item.promotionSubject}, #{item.createdDate},
    15         #{item.createdBy}, #{item.lastUpdatedDate}, #{item.lastUpdatedBy}, #{item.removeFlag}, #{item.weight}, #{item.volume},
    16         #{item.shortName}, #{item.specName}
    17       )
    18     </foreach>
    19   </insert>

    细节方面需自己完善下

  • 相关阅读:
    按钮的样式
    UIButton的状态
    什么是按钮
    图标下载网站 http://www.easyicon.net/
    开发中常用的颜色
    iOS中播放音效
    imagenamed和imageWithContentOfFile的区别
    资源存放问题
    UIImageView的序列帧动画
    UIImageView的frame设置
  • 原文地址:https://www.cnblogs.com/180308-new-file/p/8994027.html
Copyright © 2011-2022 走看看