批量插入,当我们有大批量的数据需要插入的时候,可以把数据放在List 里面,然后再操作批量插入。如下。

<insert id="insertNotifySettingRecord" parameterType="list"

useGeneratedKeys="true" keyProperty="key">

 

insert into

hotkidclub_notification.notify_setting_record_new

(code,memberKey,notifySettingKey,campaignTitle,appTitle,appContent,appType,appTypeId,appTag,appTagId,appImageName,appHasSecPage,smsTitle,smsContent,gzType,gzAppId,gzTmplId,

gzContent,gzTitle,gzContentColor,gzContentUserNameKeyword,gzUrl,gzIsMp,gzMpAppid,gzMpPath,deputyIndustry,mpUrl,mpType,mpAppid,mpTmplId,mpContent,mpContentUserNameKeyword,

mpPage,mpId,mpTitle,mpIsEmphasis,mpEmphasisKeyword,redirectType,typeName,redirectId,page,pageParams,appUrl,isPush,totalCount,smsCount,gzCount,mpCount,appCount,pushTimeTypeName,

pushTimeType,immedTime,scheduledStartTime,scheduledEndTime,scheduledTime,reptScheduledTime,reptStartTime,reptEndTime,reptRules,reptType,reptTimes,isRuleRept,isSecondary,

isTimesRept,isOneTimes,sendAt,recieveAt,status,pushRedirectType,pushAppTypeName,pushRedirectId,pushPage,pushPageParams,pushMpPage,pushMpId,pushIsOpen,pushTypeKey,typeKey,everId,pushEverId,updatedAt,version,reason)

values

<foreach collection="list" index="index" item="item"

separator=",">

(#{item.code},#{item.memberKey},#{item.notifySettingKey},#{item.campaignTitle},#{item.appTitle},#{item.appContent},#{item.appType},#{item.appTypeId},#{item.appTag},#{item.appTagId},#{item.appImageName},#{item.appHasSecPage},#{item.smsTitle},#{item.smsContent},#{item.gzType},#{item.gzAppId},#{item.gzTmplId},

#{item.gzContent},#{item.gzTitle},#{item.gzContentColor},#{item.gzContentUserNameKeyword},#{item.gzUrl},#{item.gzIsMp},#{item.gzMpAppid},#{item.gzMpPath},#{item.deputyIndustry},

#{item.mpUrl},#{item.mpType},#{item.mpAppid},#{item.mpTmplId},#{item.mpContent},#{item.mpContentUserNameKeyword},#{item.mpPage},#{item.mpId},#{item.mpTitle},#{item.mpIsEmphasis},

#{item.mpEmphasisKeyword},#{item.redirectType},#{item.typeName},#{item.redirectId},#{item.page},#{item.pageParams},#{item.appUrl},#{item.isPush},#{item.totalCount},#{item.smsCount},#{item.gzCount},

#{item.mpCount},#{item.appCount},#{item.pushTimeTypeName},#{item.pushTimeType},#{item.immedTime},#{item.scheduledStartTime},#{item.scheduledEndTime},#{item.scheduledTime},#{item.reptScheduledTime},#{item.reptStartTime},#{item.reptEndTime},#{item.reptRules},

#{item.reptType},#{item.reptTimes},#{item.isRuleRept},#{item.isSecondary},#{item.isTimesRept},#{item.isOneTimes},now(),NOW(),#{item.status},#{item.pushRedirectType},#{item.pushAppTypeName},#{item.pushRedirectId},#{item.pushPage},#{item.pushPageParams},#{item.pushMpPage},#{item.pushMpId},#{item.pushIsOpen},#{item.pushTypeKey},#{item.typeKey},#{item.everId},#{item.pushEverId},NOW(),0,#{item.reason}

)

 

</foreach>

</insert>

posted @ 2021-03-01 14:09  夏之  阅读(237)  评论(0编辑  收藏  举报