mybatis中语句
<insert id="addInvestorFileupload" parameterType="java.util.List"> insert into investor_file_info (id, userid, url, type, uploaddate, path, approve_id ) select SEQ_INVESTOR_FILE_INFO.NEXTVAL , A.* from( <foreach collection="list" index="index" item="item" separator=" union " > select #{item.userId}, #{item.investorUrl}, #{item.investorType}, sysdate, #{item.investorPath}, #{item.investorApproveId} from dual </foreach> )A </insert>
oracle数据库中运行是下面这种代码
insert into testcuijia(id,name,sex)
select seq_home_banner.nextval,A.*
from ( select '11','男' from dual
union select '22','女' from dual) A
mysql一样,只是序列不用写了,直接用自增主键就可以
insert into testcuijia(name,sex)
select A.*
from ( select '11','男' from dual
union select '22','女' from dual) A