C/C++教程

MyBatis+Oracle+Sequence

本文主要是介绍MyBatis+Oracle+Sequence,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
  1. MyBatis+Oracle+Sequence批量插入
<insert id="batchInsertInpNurseInOutVolume" useGeneratedKeys="true" parameterType="java.util.List"> 
	<selectKey resultType="long" keyProperty="id" order="BEFORE"> 
		SELECT
			BHIS.SEQ_INP_NURSE_IN_OUT_VOLUME.NEXTVAL
		FROM
			DUAL 
	</selectKey>
	insert into BHIS.INP_NURSE_IN_OUT_VOLUME 
		  ( 
			 NURSE_VOLUME_ID,
			 NURSE_RECORD_ID,
			 TYPE,
			 VOLUME_NAME,
			 VOLUME_MEASURE,
			 COLOUR_CHARACTER,
			 CREATED_BY,
			 CREATED_DATE,
			 REMARK,
			 STATUS
		  ) SELECT BHIS.SEQ_INP_NURSE_IN_OUT_VOLUME.NEXTVAL, DETAIL.* FROM ( 
			<foreach collection="list" item="item" index="index" separator="UNION ALL" > 
				SELECT 
					#{item.nurseRecordId, jdbcType=DECIMAL}, 
					#{item.type, jdbcType=VARCHAR}, 
					#{item.volumeName, jdbcType=DECIMAL}, 
					#{item.volumeMeasure, jdbcType=VARCHAR}, 
					#{item.colourCharacter, jdbcType=VARCHAR}, 
					#{item.createdBy, jdbcType=DECIMAL}, 
					#{item.createdDate, jdbcType=TIMESTAMP}, 
					#{item.remark, jdbcType=TIMESTAMP},
					#{item.status, jdbcType=DECIMAL}
				FROM 
					DUAL 
			</foreach>
		) DETAIL 
 </insert>
这篇关于MyBatis+Oracle+Sequence的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!