MyBatis-Oracle生成主键,嵌套对象中的List增加
<insert id="insert">
<selectKey order="BEFORE" keyProperty="id" resultType="int">
SELECT SEQ_ROLE_PERMISSION.NEXTVAL FROM dual
</selectKey>
INSERT INTO t_role(id,name) VALUES(#{id},#{name})
</insert>
<insert id="insertClazzStudent">
insert into t_clazz_student(id,clazz,student)
select SEQ_CLAZZ_STUDENT.NEXTVAL id,A.*
from(
<foreach collection="studentList" item="student" separator="union all" >
select
#{id} class,
#{student.id} student
from dual
</foreach>
)A
</insert>