まず第一に、MyBatisバージョンを返すためにレコードを挿入するには低い点が必要です。一方、バッチ挿入リターンはバージョン3.3.1にアップグレードする必要があり、3.3.0の前には不可能です。
<Dependency> groupId> org.mybatis </groupid> <artifactid> mybatis-spring </artifactid> <バージョン> 3.3.1 </version> </dependency>
1.mysql
<ID = "INSERTINSERTBYBATCH" useGeneratedKeys = "true" keyproperty = "id" parametertype = "java.util.list"> inserting to test(sblsh、xh、jsjg、is_success、is_display、gmt_create、gmt_modify = "" "" Iteam = "" "" "Iteam =" "" "Iteam =" "" Item = "" Itec = "" "Itecy separator = "、">(#{item.sblsh、jdbctype = bigint}、#{item.xh、jdbctype = char}、#{item.jsjg、jdbctype = bigint}、#{item.issuccess、jdbctype = tinyint}、#{item.isdippe、jdistplay、jd sysdate()、sysdate()、#{item.createuser、jdbctype = varchar})</foreach> </insert>generatedKeys = "true" keyproperty = "プライマリキーフィールド"
2.オラクル
<ID = "INSERTINSERTBATCH"> <SELECTKEY KEYPROPERTY = "ID" resultType = "long" order = "before"> select test.nextval as dual </selectkey> insert into test(value、gmt_create、gmt_modified)select test.nextval、A。* foreach = "Index" #{item.value、jdbctype = varchar}、#{item.gmtcreate、jdbctype = date}、#{item.gmtmodified、jdbctype = date} from dual </foreach>)a </insert>上記の記事MyBatis挿入またはバッチ挿入は、自己成長の主要なキーレコードを含む例を返します。私があなたと共有するすべてのコンテンツです。参照を提供できることを願っています。wulin.comをもっとサポートできることを願っています。