fuliqi
2025-01-06 7a93f4097430703dc60c4aee0240ed348a0ab1df
ycl-server/src/main/resources/mapper/zgyw/CalculateRecordMapper.xml
@@ -14,6 +14,28 @@
        <collection property="recordList" column="contract_id" select="selectByContractId" ofType="com.ycl.platform.domain.vo.CalculateMoneyRuleVO"/>
    </resultMap>
    <update id="updateBatch" parameterType="java.util.List">
        update t_calculate_record
        <trim prefix="set" suffixOverrides=","><!-- 表示在生成的 SQL 语句前面添加 set 关键字,并移除末尾逗号 -->
            <trim prefix="deduct_money =case" suffix="end,"><!-- 构造case语法 末尾加上end,如果需要更新多个字段复制这个trim -->
                <foreach collection="list" item="item">
                    when id=#{item.id} then #{item.deductMoney}
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
            #{item.id,jdbcType=BIGINT}
        </foreach>
    </update>
    <update id="batchPublish">
        update t_calculate_record set status = 'publish'
        where contract_id = #{contractId} and which_year =#{whichYear}
    </update>
    <update id="updatePublishById">
        update t_calculate_record set status = #{status}
        where id = #{id}
    </update>
</mapper>