update 批量更新

This commit is contained in:
Guoqs
2025-07-24 16:37:08 +08:00
parent f09e2a0630
commit 8002d86e7a
2 changed files with 103 additions and 4 deletions

View File

@@ -1,15 +1,20 @@
package com.jsowell.pile.domain;
import lombok.*;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
/**
* 会员钱包流水表
*/
@Getter
@Setter
@Data
@Accessors(chain = true)
@SuperBuilder
@Builder
@AllArgsConstructor
@NoArgsConstructor

View File

@@ -258,6 +258,100 @@
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update member_wallet_log
<trim prefix="set" suffixOverrides=",">
<trim prefix="member_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.memberId != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="wallet_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.walletCode != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.walletCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="`type` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.type != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="sub_type = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.subType != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.subType,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.amount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.amount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="category = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.category != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.category,jdbcType=CHAR}
</if>
</foreach>
</trim>
<trim prefix="related_order_code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.relatedOrderCode != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.relatedOrderCode,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="before_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.beforeAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.beforeAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="after_amount = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.afterAmount != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.afterAmount,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createBy != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="create_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createTime != null">
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into member_wallet_log