更新UUID到新费用行和阴影同步Mapper的注释,新增关联表回写逻辑

This commit is contained in:
wuweihua
2026-11-15 09:01:19 +08:00
parent 4de755ca60
commit 0179a35942
8 changed files with 303 additions and 559 deletions
@@ -234,71 +234,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where f.fee_id = #{oldId}
</insert>
<insert id="insertArDetailNew">
insert into ar_bill_detail_new (
detail_id, ar_bill_id, prc_order_bill_id, detail_no,
order_no, tracking_no, transfer_no, receive_time,
product_code, product_name, goods_description, country_code,
country_name, dest_postcode, actual_weight, receive_weight,
volume_weight, charge_weight, freight_rate, registration_fee,
pkg_length, pkg_width, pkg_height, currency,
total_amount, product_amount, redline_amount, billing_fail_status,
remark, create_by, create_time
)
select
d.detail_id, d.ar_bill_id, #{newBillId}, d.detail_no,
d.order_no, d.tracking_no, d.transfer_no, d.receive_time,
d.product_code, d.product_name, d.goods_description, d.country_code,
d.country_name, d.dest_postcode, d.actual_weight, d.receive_weight,
d.volume_weight, d.charge_weight, d.freight_rate, d.registration_fee,
d.pkg_length, d.pkg_width, d.pkg_height, d.currency,
d.total_amount, d.product_amount, d.redline_amount, d.billing_fail_status,
d.remark, d.create_by, d.create_time
from ar_bill_detail d
where d.prc_order_bill_id = #{oldBillId}
</insert>
<!-- 现网关联表回写 order_id(旧 UUID 列不动) -->
<select id="selectArDetailFees" resultType="com.bms.price.migration.domain.UuidToNewFeeRow">
select f.prc_income_bill_fee_id as feeId, cast(f.detail_fee_id as char) as parentId
from ar_bill_detail_fee f
inner join ar_bill_detail d on d.detail_id = f.detail_id
where d.prc_order_bill_id = #{oldBillId}
order by f.detail_fee_id
</select>
<update id="updatePayBillOrderId">
update prc_pay_bill
set order_id = #{newBillId}
where bill_id = #{oldBillId}
</update>
<insert id="insertArDetailFeeNew">
insert into ar_bill_detail_fee_new (
detail_fee_id, detail_id, prc_income_bill_fee_id, fee_no,
fee_type, fee_name, sc_id, quantity,
unit, unit_price, amount, product_amount,
redline_amount, currency, calculation_formula, round_mode,
remark, create_by, create_time
)
select
f.detail_fee_id, f.detail_id, #{newFeeId}, f.fee_no,
f.fee_type, f.fee_name, f.sc_id, f.quantity,
f.unit, f.unit_price, f.amount, f.product_amount,
f.redline_amount, f.currency, f.calculation_formula, f.round_mode,
f.remark, f.create_by, f.create_time
from ar_bill_detail_fee f
where f.detail_fee_id = #{detailFeeId}
</insert>
<update id="updatePayFeeOrderId">
update prc_pay_bill_fee
set order_id = #{newBillId}
where bill_id = #{oldBillId}
</update>
<insert id="insertBillingTaskNew">
insert into prc_billing_task_new (
task_id, transfer_no, tracking_no, order_no,
customer_code, bill_type, success_status, bill_time,
bill_id, fail_code, error_message, create_by,
create_time, update_by, update_time
)
select
t.task_id, t.transfer_no, t.tracking_no, t.order_no,
t.customer_code, t.bill_type, t.success_status, t.bill_time,
#{newBillId}, t.fail_code, t.error_message, t.create_by,
t.create_time, t.update_by, t.update_time
from prc_billing_task t
where t.bill_id = #{oldBillId}
</insert>
<update id="updateArDetailOrderId">
update ar_bill_detail
set order_id = #{newBillId}
where prc_order_bill_id = #{oldBillId}
</update>
<update id="updatePayBillLineOrderId">
update pay_bill_line
set order_id = #{newBillId}
where order_bill_id = #{oldBillId}
</update>
<update id="updateBillingTaskOrderId">
update prc_billing_task
set order_id = #{newBillId}
where bill_id = #{oldBillId}
</update>
<update id="updateArGenTaskOrderId">
update ar_bill_generate_task
set order_id = #{newBillId}
where last_source_bill_id = #{oldBillId}
</update>
<insert id="insertJobLogStart" useGeneratedKeys="true" keyProperty="jobLogId" keyColumn="id">
insert into mig_bi_job_log (batch_no, fetched, success, fail, skip, started_at, remark)