mybatis批量和更新(mysql)

<!-- 批量更新已存在的会员信息 begin -->
    <update id="batchUpdateOmemBean" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" open="" separator=";"  close="">
            update omem
            <set>
                <if test="item.logname != null and item.logname != ''">
                    LogName = #{item.logname},
                </if>
                <if test="item.orgid != null">
                    OrgId = #{item.orgid},
                </if>
                <if test="item.memid != null ">
                    MemId = #{item.memid},
                </if>
                <if test="item.memname != null and item.memname != ''">
                    MemName = #{item.memname},
                </if>
                <if test="item.gender != null and item.gender != ''">
                    Gender = #{item.gender},
                </if>
                <if test="item.birthdate != null and item.birthdate != ''">
                    BirthDate = #{item.birthdate},
                </if>
                <if test="item.tel != null and item.tel != ''">
                    Tel = #{item.tel},
                </if>
                <if test="item.email != null and item.email != ''">
                    Email = #{item.email},
                </if>
                <if test="item.idcard != null and item.idcard != ''">
                    IdCard = #{item.idcard},
                </if>
                <if test="item.nativeaddr != null and item.nativeaddr != ''">
                    NativeAddr = #{item.nativeaddr},
                </if>
                <if test="item.address != null and item.address != ''">
                    Address = #{item.address},
                </if>
                <if test="item.marrystatus != null and item.marrystatus != ''">
                    MarryStatus = #{item.marrystatus},
                </if>
                <if test="item.educationstatus != null and item.educationstatus != ''">
                    EducationStatus = #{item.educationstatus},
                </if>
                <if test="item.occupation != null ">
                    Occupation = #{item.occupation},
                </if>
                <if test="item.docid != null">
                    Docid = #{item.docid},
                </if>
                <if test="item.docname != null and item.docname != ''">
                    DocName = #{item.docname},
                </if>
                <if test="item.usetag != null">
                    UseTag = #{item.usetag},
                </if>
                <if test="item.createtime != null and item.createtime != ''">
                    CreateTime = #{item.createtime},
                </if>
                <if test="item.headimg != null and item.headimg != ''">
                    headImg = #{item.headimg},
                </if>
                <if test="item.headaddress != null and item.headaddress != ''">
                    HeadAddress = #{item.headaddress},
                </if>
                <if test="item.status != null">
                    status = #{item.status},
                </if>
                <if test="item.source != null ">
                    source = #{item.source},
                </if>
                <if test="item.uniqueId != null and item.uniqueId != ''">
                    unique_id = #{item.uniqueId}
                </if>
            </set>
            where Memberid = #{item.memberid}
         </foreach>
    </update>
    <!-- 批量更新已存在的会员信息 end -->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值