<!-- 获取数据库自动生成的主键 -->
<insert id="xxxx" parameterType="xxxx" >
<selectKey resultType ="java.lang.Long" keyProperty= "kid" order= "AFTER"> SELECT LAST_INSERT_ID() </selectKey > insert into p_stock_check_detail ( checkid, stockid, ) values <foreach collection ="list" item="msk" separator =","> ( #{msk.checkid}, #{msk.pid}, ) </foreach > </insert>