修改计费订单ID类型为Long,优化相关逻辑
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
select 1 from pay_bill_line l
|
||||
inner join pay_bill b on b.bill_id = l.bill_id
|
||||
where l.order_bill_id = o.bill_id
|
||||
and (l.fee_id is null or l.fee_id = '')
|
||||
and l.fee_id is null
|
||||
and b.status not in ('VOID', 'RED')
|
||||
)) as unbilledCount,
|
||||
(select b.bill_no from pay_bill_line l
|
||||
@@ -240,7 +240,7 @@
|
||||
select 1 from pay_bill_line l
|
||||
inner join pay_bill b on b.bill_id = l.bill_id
|
||||
where l.order_bill_id = f.bill_id
|
||||
and (l.fee_id is null or l.fee_id = '')
|
||||
and l.fee_id is null
|
||||
and b.status not in ('VOID', 'RED')
|
||||
)
|
||||
order by f.bill_id, f.fee_id
|
||||
|
||||
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
||||
<select id="selectByBillId" parameterType="Long" resultMap="PrcIncomeBillFeeResult">
|
||||
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
from prc_income_bill_fee
|
||||
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by bill_id, field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<select id="selectByFeeId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
||||
<select id="selectByFeeId" parameterType="Long" resultMap="PrcIncomeBillFeeResult">
|
||||
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
from prc_income_bill_fee
|
||||
@@ -78,23 +78,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and fee_type = #{feeType}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee">
|
||||
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee" useGeneratedKeys="true" keyProperty="feeId">
|
||||
insert into prc_income_bill_fee (
|
||||
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
) values (
|
||||
#{feeId}, #{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{roundMode}, #{remark},
|
||||
#{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{productAmount}, #{redlineAmount}, #{currency}, #{roundMode}, #{remark},
|
||||
#{arBillStatus}, #{manualFlag}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="feeId">
|
||||
insert into prc_income_bill_fee (
|
||||
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, product_amount, redline_amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.feeId}, #{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
(#{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
#{item.productAmount}, #{item.redlineAmount},
|
||||
#{item.currency}, #{item.roundMode}, #{item.remark},
|
||||
#{item.arBillStatus}, #{item.manualFlag}, sysdate())
|
||||
@@ -173,15 +173,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</update>
|
||||
|
||||
<delete id="deleteByFeeId" parameterType="String">
|
||||
<delete id="deleteByFeeId" parameterType="Long">
|
||||
delete from prc_income_bill_fee where fee_id = #{feeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
<delete id="deleteByBillId" parameterType="Long">
|
||||
delete from prc_income_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAutoFeesByBillId" parameterType="String">
|
||||
<delete id="deleteAutoFeesByBillId" parameterType="Long">
|
||||
delete from prc_income_bill_fee
|
||||
where bill_id = #{billId}
|
||||
and (manual_flag is null or manual_flag <> '1')
|
||||
|
||||
@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from prc_income_bill
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||
<select id="selectByBillId" parameterType="Long" resultMap="PrcIncomeBillResult">
|
||||
<include refid="selectPrcIncomeBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
@@ -44,19 +44,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByIncomeBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||
<select id="selectByIncomeBillId" parameterType="Long" resultMap="PrcIncomeBillResult">
|
||||
<include refid="selectPrcIncomeBillVo"/>
|
||||
where income_bill_id = #{incomeBillId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill" useGeneratedKeys="true" keyProperty="incomeBillId">
|
||||
insert into prc_income_bill (
|
||||
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
bill_id, currency, product_amount, redline_amount,
|
||||
sales_amount, income_total, refund_status,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{salesAmount}, #{incomeTotal}, #{refundStatus},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
@@ -80,14 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill" useGeneratedKeys="true" keyProperty="incomeBillId">
|
||||
insert into prc_income_bill (
|
||||
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
bill_id, currency, product_amount, redline_amount,
|
||||
sales_amount, income_total, refund_status,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{salesAmount}, #{incomeTotal}, #{refundStatus},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
@@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update_time = sysdate()
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
<delete id="deleteByBillId" parameterType="Long">
|
||||
delete from prc_income_bill where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
@@ -189,7 +189,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from prc_order_bill_ext
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcOrderBillExtResult">
|
||||
<select id="selectByBillId" parameterType="Long" resultMap="PrcOrderBillExtResult">
|
||||
<include refid="selectPrcOrderBillExtVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
@@ -157,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
limit 2
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillById" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
<select id="selectPrcOrderBillById" parameterType="Long" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
@@ -578,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<!-- Id-only for large local rebill (avoid loading full rows into memory). -->
|
||||
<select id="selectPrcOrderBillIds" parameterType="PrcOrderBill" resultType="string">
|
||||
<select id="selectPrcOrderBillIds" parameterType="PrcOrderBill" resultType="java.lang.Long">
|
||||
select p.bill_id
|
||||
from prc_order_bill p
|
||||
<where>
|
||||
@@ -785,7 +785,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectPrcOrderBillByCustomerPeriodCursor" resultMap="PrcOrderBillArSourceResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
<include refid="customerPeriodConditions"/>
|
||||
<if test="lastSourceBillId != null and lastSourceBillId != ''">
|
||||
<if test="lastSourceBillId != null">
|
||||
and p.bill_id > #{lastSourceBillId}
|
||||
</if>
|
||||
order by p.bill_id
|
||||
@@ -829,9 +829,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill" useGeneratedKeys="true" keyProperty="billId">
|
||||
insert into prc_order_bill (
|
||||
bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||
bill_key, order_no, tracking_no, transfer_no,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
|
||||
customer_id, customer_code, customer_name,
|
||||
pieces, actual_weight, receive_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||
@@ -845,7 +845,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, error_message, round_mode,
|
||||
create_time
|
||||
) values (
|
||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||
#{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
|
||||
#{customerId}, #{customerCode}, #{customerName},
|
||||
#{pieces}, #{actualWeight}, #{receiveWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
|
||||
|
||||
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillFeeResult">
|
||||
<select id="selectByBillId" parameterType="Long" resultMap="PrcPayBillFeeResult">
|
||||
select fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
|
||||
fee_source, source_id, is_deleted, create_time
|
||||
from prc_pay_bill_fee
|
||||
@@ -31,23 +31,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee">
|
||||
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee" useGeneratedKeys="true" keyProperty="feeId">
|
||||
insert into prc_pay_bill_fee (
|
||||
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
|
||||
bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
|
||||
fee_source, source_id, is_deleted, create_time
|
||||
) values (
|
||||
#{feeId}, #{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{feeLevel}, #{amount}, #{currency}, #{roundMode}, #{remark},
|
||||
#{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{feeLevel}, #{amount}, #{currency}, #{roundMode}, #{remark},
|
||||
ifnull(#{feeSource}, 'CALC'), #{sourceId}, ifnull(#{isDeleted}, '0'), sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="feeId">
|
||||
insert into prc_pay_bill_fee (
|
||||
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
|
||||
bill_id, pay_bill_id, fee_type, fee_name, sc_id, fee_level, amount, currency, round_mode, remark,
|
||||
fee_source, source_id, is_deleted, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.feeId}, #{item.billId}, #{item.payBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.feeLevel},
|
||||
(#{item.billId}, #{item.payBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.feeLevel},
|
||||
#{item.amount}, #{item.currency}, #{item.roundMode}, #{item.remark}, ifnull(#{item.feeSource}, 'CALC'),
|
||||
#{item.sourceId}, ifnull(#{item.isDeleted}, '0'), sysdate())
|
||||
</foreach>
|
||||
@@ -69,19 +69,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update prc_pay_bill_fee f
|
||||
inner join prc_pay_bill b on b.bill_id = f.bill_id
|
||||
set f.pay_bill_id = b.pay_bill_id
|
||||
where (f.pay_bill_id is null or f.pay_bill_id = '')
|
||||
where f.pay_bill_id is null
|
||||
and f.bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">#{billId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectBillIdsByLadingFee" resultType="String">
|
||||
<select id="selectBillIdsByLadingFee" resultType="java.lang.Long">
|
||||
select distinct bill_id
|
||||
from prc_pay_bill_fee
|
||||
where fee_source = 'LADING'
|
||||
and sc_id = #{feeId}
|
||||
and ifnull(is_deleted, '0') = '0'
|
||||
and bill_id is not null
|
||||
and bill_id != ''
|
||||
</select>
|
||||
|
||||
<update id="markLadingFeeDeleted">
|
||||
@@ -92,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and ifnull(is_deleted, '0') = '0'
|
||||
</update>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
<delete id="deleteByBillId" parameterType="Long">
|
||||
delete from prc_pay_bill_fee
|
||||
where bill_id = #{billId}
|
||||
and (fee_source is null or fee_source = '' or fee_source = 'CALC')
|
||||
|
||||
@@ -30,24 +30,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
from prc_pay_bill
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillResult">
|
||||
<select id="selectByBillId" parameterType="Long" resultMap="PrcPayBillResult">
|
||||
<include refid="selectPrcPayBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
<select id="selectByPayBillId" parameterType="String" resultMap="PrcPayBillResult">
|
||||
<select id="selectByPayBillId" parameterType="Long" resultMap="PrcPayBillResult">
|
||||
<include refid="selectPrcPayBillVo"/>
|
||||
where pay_bill_id = #{payBillId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPayBill" parameterType="PrcPayBill">
|
||||
<insert id="insertPrcPayBill" parameterType="PrcPayBill" useGeneratedKeys="true" keyProperty="payBillId">
|
||||
insert into prc_pay_bill (
|
||||
pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
bill_id, currency, product_amount, redline_amount,
|
||||
cost_amount, pay_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{costAmount}, #{payTotal},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
@@ -70,14 +70,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<insert id="upsertPrcPayBill" parameterType="PrcPayBill">
|
||||
<insert id="upsertPrcPayBill" parameterType="PrcPayBill" useGeneratedKeys="true" keyProperty="payBillId">
|
||||
insert into prc_pay_bill (
|
||||
pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
bill_id, currency, product_amount, redline_amount,
|
||||
cost_amount, pay_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{costAmount}, #{payTotal},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
@@ -98,11 +98,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<insert id="insertMissingPayBills">
|
||||
insert into prc_pay_bill (
|
||||
pay_bill_id, bill_id, currency, pay_total,
|
||||
bill_id, currency, pay_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time, update_by, update_time
|
||||
)
|
||||
select replace(uuid(), '-', ''), o.bill_id, ifnull(nullif(o.currency, ''), 'CNY'), 0,
|
||||
select o.bill_id, ifnull(nullif(o.currency, ''), 'CNY'), 0,
|
||||
o.belong_saler, o.belong_saler_code, o.settlement_man, o.settlement_man_code,
|
||||
#{operator}, sysdate(), #{operator}, sysdate()
|
||||
from prc_order_bill o
|
||||
@@ -129,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">#{billId}</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
<delete id="deleteByBillId" parameterType="Long">
|
||||
delete from prc_pay_bill where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user