144 lines
9.1 KiB
XML
144 lines
9.1 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.bms.ar.mapper.ArBillDetailMapper">
|
|
<!-- 账单明细读写;详情页分页查询,导出任务按游标批量查询。 -->
|
|
<resultMap id="ArBillDetailResult" type="ArBillDetail">
|
|
<id property="detailId" column="detail_id"/>
|
|
<result property="arBillId" column="ar_bill_id"/>
|
|
<result property="prcOrderBillId" column="prc_order_bill_id"/>
|
|
<result property="detailNo" column="detail_no"/>
|
|
<result property="orderNo" column="order_no"/>
|
|
<result property="trackingNo" column="tracking_no"/>
|
|
<result property="transferNo" column="transfer_no"/>
|
|
<result property="receiveTime" column="receive_time"/>
|
|
<result property="productCode" column="product_code"/>
|
|
<result property="productName" column="product_name"/>
|
|
<result property="goodsDescription" column="goods_description"/>
|
|
<result property="countryCode" column="country_code"/>
|
|
<result property="countryName" column="country_name"/>
|
|
<result property="destPostcode" column="dest_postcode"/>
|
|
<result property="actualWeight" column="actual_weight"/>
|
|
<result property="volumeWeight" column="volume_weight"/>
|
|
<result property="chargeWeight" column="charge_weight"/>
|
|
<result property="freightRate" column="freight_rate"/>
|
|
<result property="registrationFee" column="registration_fee"/>
|
|
<result property="pkgLength" column="pkg_length"/>
|
|
<result property="pkgWidth" column="pkg_width"/>
|
|
<result property="pkgHeight" column="pkg_height"/>
|
|
<result property="currency" column="currency"/>
|
|
<result property="totalAmount" column="total_amount"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
</resultMap>
|
|
|
|
<select id="selectByBillId" parameterType="long" resultMap="ArBillDetailResult">
|
|
select 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, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
|
currency, total_amount, remark, create_by, create_time
|
|
from ar_bill_detail where ar_bill_id = #{arBillId} order by detail_no
|
|
</select>
|
|
|
|
<select id="selectByBillIdAndSourceIds" resultMap="ArBillDetailResult">
|
|
select 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, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
|
currency, total_amount, remark, create_by, create_time
|
|
from ar_bill_detail
|
|
where ar_bill_id = #{arBillId}
|
|
and prc_order_bill_id in
|
|
<foreach collection="sourceBillIds" item="sourceBillId" open="(" separator="," close=")">
|
|
#{sourceBillId}
|
|
</foreach>
|
|
order by detail_no
|
|
</select>
|
|
|
|
<resultMap id="ArBillDetailWithFeesResult" type="ArBillDetail" extends="ArBillDetailResult">
|
|
<collection property="fees" ofType="ArBillDetailFee">
|
|
<id property="detailFeeId" column="fee_detail_id"/>
|
|
<result property="detailId" column="fee_parent_detail_id"/>
|
|
<result property="prcIncomeBillFeeId" column="fee_prc_income_bill_fee_id"/>
|
|
<result property="feeNo" column="fee_no"/>
|
|
<result property="feeType" column="fee_type"/>
|
|
<result property="feeName" column="fee_name"/>
|
|
<result property="scId" column="fee_sc_id"/>
|
|
<result property="quantity" column="fee_quantity"/>
|
|
<result property="unit" column="fee_unit"/>
|
|
<result property="unitPrice" column="fee_unit_price"/>
|
|
<result property="amount" column="fee_amount"/>
|
|
<result property="currency" column="fee_currency"/>
|
|
<result property="calculationFormula" column="fee_calculation_formula"/>
|
|
<result property="roundMode" column="fee_round_mode"/>
|
|
<result property="remark" column="fee_remark"/>
|
|
<result property="createBy" column="fee_create_by"/>
|
|
<result property="createTime" column="fee_create_time"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="selectByBillIdWithFees" parameterType="long" resultMap="ArBillDetailWithFeesResult">
|
|
select d.detail_id, d.ar_bill_id, d.prc_order_bill_id, 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.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.remark, d.create_by, d.create_time,
|
|
f.detail_fee_id as fee_detail_id, f.detail_id as fee_parent_detail_id,
|
|
f.prc_income_bill_fee_id as fee_prc_income_bill_fee_id,
|
|
f.fee_no, f.fee_type, f.fee_name, f.sc_id as fee_sc_id, f.quantity as fee_quantity,
|
|
f.unit as fee_unit, f.unit_price as fee_unit_price, f.amount as fee_amount,
|
|
f.currency as fee_currency, f.calculation_formula as fee_calculation_formula,
|
|
f.round_mode as fee_round_mode, f.remark as fee_remark, f.create_by as fee_create_by,
|
|
f.create_time as fee_create_time
|
|
from ar_bill_detail d
|
|
left join ar_bill_detail_fee f on f.detail_id = d.detail_id
|
|
where d.ar_bill_id = #{arBillId}
|
|
order by d.detail_no, d.detail_id, f.fee_no, f.detail_fee_id
|
|
</select>
|
|
|
|
<select id="selectExportPage" resultMap="ArBillDetailResult">
|
|
select 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, volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height,
|
|
currency, total_amount, remark, create_by, create_time
|
|
from ar_bill_detail
|
|
where ar_bill_id = #{arBillId} and detail_no > #{lastDetailNo}
|
|
order by detail_no
|
|
limit #{pageSize}
|
|
</select>
|
|
|
|
<insert id="insert" parameterType="ArBillDetail" useGeneratedKeys="true" keyProperty="detailId">
|
|
insert into ar_bill_detail (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,
|
|
volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency,
|
|
total_amount,
|
|
remark, create_by, create_time)
|
|
values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{transferNo}, #{receiveTime},
|
|
#{productCode}, #{productName}, #{goodsDescription}, #{countryCode}, #{countryName},
|
|
#{destPostcode}, #{actualWeight}, #{volumeWeight}, #{chargeWeight}, #{freightRate}, #{registrationFee}, #{pkgLength}, #{pkgWidth},
|
|
#{pkgHeight}, #{currency}, #{totalAmount}, #{remark}, #{createBy}, sysdate())
|
|
</insert>
|
|
|
|
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailId">
|
|
insert into ar_bill_detail (
|
|
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,
|
|
volume_weight, charge_weight, freight_rate, registration_fee, pkg_length, pkg_width, pkg_height, currency, total_amount,
|
|
remark, create_by, create_time
|
|
) values
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.arBillId}, #{item.prcOrderBillId}, #{item.detailNo}, #{item.orderNo}, #{item.trackingNo},
|
|
#{item.transferNo}, #{item.receiveTime}, #{item.productCode}, #{item.productName}, #{item.goodsDescription},
|
|
#{item.countryCode}, #{item.countryName}, #{item.destPostcode}, #{item.actualWeight},
|
|
#{item.volumeWeight}, #{item.chargeWeight}, #{item.freightRate}, #{item.registrationFee}, #{item.pkgLength}, #{item.pkgWidth}, #{item.pkgHeight},
|
|
#{item.currency}, #{item.totalAmount}, #{item.remark}, #{item.createBy}, sysdate())
|
|
</foreach>
|
|
</insert>
|
|
|
|
<delete id="deleteByBillId" parameterType="long">
|
|
delete from ar_bill_detail where ar_bill_id = #{arBillId}
|
|
</delete>
|
|
</mapper>
|