Mapper MYSL implementing BULK INSERT Updates

Source: Internet
Author: User
Tags bulk insert

1. BULK INSERT

<insert id= "insertconfirm" parametertype= "Java.util.List" >
Insert INTO ' TableName ' (ID) values
<foreach collection = "List" item= "item" index= "index" separator = "," >
(' ${item.id} ')
</foreach >
</insert>

2. Batch Update
<update id= "updateconfirm" parametertype= "Java.util.List" >
Update ' TableName '
<trim prefix= "Set" suffixoverrides= "," >
<trim prefix= "Bgt_stage =case" suffix= "End," >
<foreach collection= "list" item= "I" index= "index" >
<if test= "I.bgtstage!=null" >
When tasktypeid= ' ${i.tasktypeid} ' and depcode= ' ${i.depcode} ' then
' ${i.bgtstage} '
</if>
</foreach>
else Bgt_stage
</trim>
<trim prefix= "Confirmtime =case" suffix= "End," >
<foreach collection= "list" item= "I" index= "index" >
<if test= "I.confirmtime!=null" >
When tasktypeid= ' ${i.tasktypeid} ' and depcode= ' ${i.depcode} ' then
' ${i.confirmtime} '
</if>
</foreach>
else Confirmtime
</trim>
</trim>
</update>

Trim Property

Prefix: Prefixes overwrite and increase their contents

Suffix: suffixes overwrite and increase their contents

Prefixoverrides: Criteria for judging prefixes

Suffixoverrides: The condition of the suffix judgment

Mapper MYSL implementing BULK INSERT Updates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.