<insert id="batchSaveAllocate"> <foreach collection="allocateList" separator=";" item="item" index="index"> insert into ${tablePrifix}i_u_reimbursement_allocate <trim prefix="(" suffix=")" suffixOverrides=","> <if test="item.id != null and item.id != ''">id,</if> <if test="item.deptId != null and item.deptId != ''">dept_id,</if> <if test="item.allocateType != null and item.allocateType != ''">allocate_type,</if> <if test="item.rewardItems != null and item.rewardItems != ''">reward_items,</if> <if test="item.money != null and item.money != ''">money,</if> <if test="item.allocateEntryTime != null">allocate_entry_time,</if> <if test="item.createCode != null and item.createCode != ''">create_code,</if> <if test="item.creatreName != null and item.creatreName != ''">creatre_name,</if> <if test="item.createTime != null">create_time,</if> <if test="item.dType != null and item.dType != ''">d_type,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="item.id != null and item.id != ''">#{item.id},</if> <if test="item.deptId != null and item.deptId != ''">#{item.deptId},</if> <if test="item.allocateType != null and item.allocateType != ''">#{item.allocateType},</if> <if test="item.rewardItems != null and item.rewardItems != ''">#{item.rewardItems},</if> <if test="item.money != null and item.money != ''">#{item.money},</if> <if test="item.allocateEntryTime != null">#{item.allocateEntryTime},</if> <if test="item.createCode != null and item.createCode != ''">#{item.createCode},</if> <if test="item.creatreName != null and item.creatreName != ''">#{item.creatreName},</if> <if test="item.createTime != null">#{item.createTime},</if> <if test="item.dType != null and item.dType != ''">#{item.dType},</if> </trim> </foreach> </insert>
mybatis动态批量insert
于 2022-05-24 16:44:50 首次发布