insert语句 foreach 、虚表的使用 mybatis
来源:互联网 发布:广东玉米数据网 编辑:程序博客网 时间:2024/05/16 08:01
<insert id="saveEoceonfirmDetail" parameterType="java.util.List">
INSERT INTO OMS_OD_STOCKIN_ITEMS
(ID,
ORDER_ID,
ORDER_CODE,
GOODS_CODE,
GOODS_NAME,
ACCEPTABLE_QTY,
STOCKIN_DATE,
CREATED_BY,
CREATED_TIME,
VERSION,
IS_INACTIVE,
DEFECTIVE_QTY)
<foreach collection="list" item="item" index="index" open="(" close=")" separator="UNION ALL"> //传入的参数是List<Map<String, Object>>
(SELECT
#{item.id},
#{item.entry_order_id},
#{item.entry_order_code},
#{item.goods_code},
#{item.goods_name},
#{item.acceptable_qty},
<if test="item.stockin_date !=null and item.stockin_date !=''">
TO_TIMESTAMP( #{item.stockin_date},'YYYY-MM-DD HH24:MI:SS') ,
</if>
<if test="item.stockin_date ==null or item.stockin_date ==''">
sysdate,
</if>
'oms',
sysdate,
0,
0,
#{item.defective_qty}
FROM dual) //虚表
</foreach>
</insert>
INSERT INTO OMS_OD_STOCKIN_ITEMS
(ID,
ORDER_ID,
ORDER_CODE,
GOODS_CODE,
GOODS_NAME,
ACCEPTABLE_QTY,
STOCKIN_DATE,
CREATED_BY,
CREATED_TIME,
VERSION,
IS_INACTIVE,
DEFECTIVE_QTY)
<foreach collection="list" item="item" index="index" open="(" close=")" separator="UNION ALL"> //传入的参数是List<Map<String, Object>>
(SELECT
#{item.id},
#{item.entry_order_id},
#{item.entry_order_code},
#{item.goods_code},
#{item.goods_name},
#{item.acceptable_qty},
<if test="item.stockin_date !=null and item.stockin_date !=''">
TO_TIMESTAMP( #{item.stockin_date},'YYYY-MM-DD HH24:MI:SS') ,
</if>
<if test="item.stockin_date ==null or item.stockin_date ==''">
sysdate,
</if>
'oms',
sysdate,
0,
0,
#{item.defective_qty}
FROM dual) //虚表
</foreach>
</insert>
阅读全文
0 0
- insert语句 foreach 、虚表的使用 mybatis
- mybatis的foreach语句使用问题
- MyBatis的foreach语句
- MyBatis的foreach语句
- mybatis的insert语句
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句用法
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- opencv 2.4.9+vs2013 人脸识别环境搭建,眼睛,鼻子,嘴巴等 摄像头读取和显示
- VC++/halcon入门之数据结构
- 数组,json的去重
- 利用 WireShark 深入调试网络请求
- top和ps取长补短
- insert语句 foreach 、虚表的使用 mybatis
- 写linux驱动程序的步骤
- 生成pdf可编辑也是醉了
- 9月28日云栖精选夜读:阿里云MaxCompute澳大利亚开服_“领跑”人工智能市场
- 极限元算法专家:深度学习在语音生成问题上的典型应用 | 学术分享会总结文
- Ajax发送get请求
- 论html5十大优点
- BZOJ 2743: [HEOI2012]采花 树状数组裸题
- 以太坊智能合约开发环境及总结