Files
BMS/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcBillMapper.xml
T
2026-09-10 15:53:23 +08:00

213 lines
12 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.ruoyi.price.mapper.PrcBillMapper">
<resultMap type="PrcBill" id="PrcBillResult">
<id property="billId" column="bill_id" />
<result property="billKey" column="bill_key" />
<result property="orderNo" column="order_no" />
<result property="trackingNo" column="tracking_no" />
<result property="customerId" column="customer_id" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="pieces" column="pieces" />
<result property="actualWeight" column="actual_weight" />
<result property="volume" column="volume" />
<result property="volumeWeight" column="volume_weight" />
<result property="pkgLength" column="pkg_length" />
<result property="pkgWidth" column="pkg_width" />
<result property="pkgHeight" column="pkg_height" />
<result property="shipperName" column="shipper_name" />
<result property="consigneeName" column="consignee_name" />
<result property="destPostcode" column="dest_postcode" />
<result property="warehouseCode" column="warehouse_code" />
<result property="orderTime" column="order_time" />
<result property="orderRemark" column="order_remark" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="countryCode" column="country_code" />
<result property="countryName" column="country_name" />
<result property="weight" column="weight" />
<result property="bizDate" column="biz_date" />
<result property="tmsId" column="tms_id" />
<result property="matchSource" column="match_source" />
<result property="matchMessage" column="match_message" />
<result property="priceSetId" column="price_set_id" />
<result property="priceSetCode" column="price_set_code" />
<result property="priceSetName" column="price_set_name" />
<result property="setType" column="set_type" />
<result property="bindPriority" column="bind_priority" />
<result property="customerPricesetId" column="customer_priceset_id" />
<result property="productCountryId" column="product_country_id" />
<result property="weightMin" column="weight_min" />
<result property="weightMax" column="weight_max" />
<result property="weightLabel" column="weight_label" />
<result property="effectiveDate" column="effective_date" />
<result property="chargeWeight" column="charge_weight" />
<result property="freightRate" column="freight_rate" />
<result property="baseFreightRate" column="base_freight_rate" />
<result property="discountPercent" column="discount_percent" />
<result property="registrationFee" column="registration_fee" />
<result property="freightAmount" column="freight_amount" />
<result property="surchargeAmount" column="surcharge_amount" />
<result property="payableTotal" column="payable_total" />
<result property="currency" column="currency" />
<result property="roundMode" column="round_mode" />
<result property="createBy" column="created_by" />
<result property="createTime" column="created_at" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="updated_at" />
</resultMap>
<sql id="selectPrcBillVo">
select bill_id, bill_key, order_no, tracking_no, customer_id, customer_code, customer_name,
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
match_source, match_message, price_set_id, price_set_code, price_set_name,
set_type, bind_priority, customer_priceset_id, product_country_id,
weight_min, weight_max, weight_label, effective_date, charge_weight,
freight_rate, base_freight_rate, discount_percent, registration_fee,
freight_amount, surcharge_amount, payable_total, currency, round_mode,
created_by, created_at, updated_by, updated_at
from prc_bill
</sql>
<select id="selectPrcBillByOrderNo" parameterType="String" resultMap="PrcBillResult">
<include refid="selectPrcBillVo"/>
where order_no = #{orderNo}
</select>
<select id="selectPrcBillById" parameterType="String" resultMap="PrcBillResult">
<include refid="selectPrcBillVo"/>
where bill_id = #{billId}
</select>
<select id="selectPrcBillList" parameterType="PrcBill" resultMap="PrcBillResult">
<include refid="selectPrcBillVo"/>
<where>
<if test="orderNo != null and orderNo != ''">
AND order_no like concat('%', #{orderNo}, '%')
</if>
<if test="trackingNo != null and trackingNo != ''">
AND tracking_no like concat('%', #{trackingNo}, '%')
</if>
<if test="customerCode != null and customerCode != ''">
AND customer_code like concat('%', #{customerCode}, '%')
</if>
<if test="customerName != null and customerName != ''">
AND customer_name like concat('%', #{customerName}, '%')
</if>
<if test="productCode != null and productCode != ''">
AND product_code like concat('%', #{productCode}, '%')
</if>
<if test="countryCode != null and countryCode != ''">
AND country_code = #{countryCode}
</if>
<if test="matchSource != null and matchSource != ''">
AND match_source = #{matchSource}
</if>
<if test="bizDate != null">
AND biz_date = #{bizDate}
</if>
<if test="params.beginTime != null and params.beginTime != ''">
AND date_format(created_at,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
AND date_format(created_at,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by created_at desc, bill_id desc
</select>
<insert id="insertPrcBill" parameterType="PrcBill">
insert into prc_bill (
bill_id, bill_key, order_no, tracking_no, customer_id, customer_code, customer_name,
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
match_source, match_message, price_set_id, price_set_code, price_set_name,
set_type, bind_priority, customer_priceset_id, product_country_id,
weight_min, weight_max, weight_label, effective_date, charge_weight,
freight_rate, base_freight_rate, discount_percent, registration_fee,
freight_amount, surcharge_amount, payable_total, currency, round_mode,
created_at
) values (
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{customerId}, #{customerCode}, #{customerName},
#{pieces}, #{actualWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
#{productCode}, #{productName}, #{countryCode}, #{countryName}, #{weight}, #{bizDate}, #{tmsId},
#{matchSource}, #{matchMessage}, #{priceSetId}, #{priceSetCode}, #{priceSetName},
#{setType}, #{bindPriority}, #{customerPricesetId}, #{productCountryId},
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
#{freightAmount}, #{surchargeAmount}, #{payableTotal}, #{currency}, #{roundMode},
sysdate()
)
</insert>
<update id="updatePrcBill" parameterType="PrcBill">
update prc_bill
set bill_key = #{billKey},
tracking_no = #{trackingNo},
customer_id = #{customerId},
customer_code = #{customerCode},
customer_name = #{customerName},
pieces = #{pieces},
actual_weight = #{actualWeight},
volume = #{volume},
volume_weight = #{volumeWeight},
pkg_length = #{pkgLength},
pkg_width = #{pkgWidth},
pkg_height = #{pkgHeight},
shipper_name = #{shipperName},
consignee_name = #{consigneeName},
dest_postcode = #{destPostcode},
warehouse_code = #{warehouseCode},
order_time = #{orderTime},
order_remark = #{orderRemark},
product_code = #{productCode},
product_name = #{productName},
country_code = #{countryCode},
country_name = #{countryName},
weight = #{weight},
biz_date = #{bizDate},
tms_id = #{tmsId},
match_source = #{matchSource},
match_message = #{matchMessage},
price_set_id = #{priceSetId},
price_set_code = #{priceSetCode},
price_set_name = #{priceSetName},
set_type = #{setType},
bind_priority = #{bindPriority},
customer_priceset_id = #{customerPricesetId},
product_country_id = #{productCountryId},
weight_min = #{weightMin},
weight_max = #{weightMax},
weight_label = #{weightLabel},
effective_date = #{effectiveDate},
charge_weight = #{chargeWeight},
freight_rate = #{freightRate},
base_freight_rate = #{baseFreightRate},
discount_percent = #{discountPercent},
registration_fee = #{registrationFee},
freight_amount = #{freightAmount},
surcharge_amount = #{surchargeAmount},
payable_total = #{payableTotal},
currency = #{currency},
round_mode = #{roundMode},
updated_at = sysdate()
where bill_id = #{billId}
</update>
<update id="updateBillAmounts">
update prc_bill
set surcharge_amount = #{surchargeAmount},
payable_total = #{payableTotal},
updated_at = sysdate()
where bill_id = #{billId}
</update>
</mapper>