mybatis insert into 多条记录同时返回多个ID主键方法

2019独角兽企业重金招聘Python工程师标准>>> hot3.png


         
                SELECT TVA_UPSELLADMIN_CHANNEL_SEQ.nextVal as id FROM DUAL
             
         INSERT INTO
         tva_upselladmin_channel (id,source_id, service_id, name)
         SELECT TVA_UPSELLADMIN_CHANNEL_SEQ.nextVal, A.* from (
         
         SELECT 
           #{channel.sourceId} as source_id,
           #{channel.serviceId} as service_id,
           #{channel.name}) as name
         FROM DUAL
          ) A
    

参考:https://stackoverflow.com/questions/31748177/mybatis-3-selectkey-inside-foreach 

转载于:https://my.oschina.net/u/1789379/blog/1510012

你可能感兴趣的:(mybatis insert into 多条记录同时返回多个ID主键方法)