138 lines
7.7 KiB
XML
138 lines
7.7 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.price.mapper.PrcQuoteMapper">
|
|
|
|
<resultMap type="PrcQuote" id="PrcQuoteResult">
|
|
<id property="quoteId" column="quote_id" />
|
|
<result property="quoteKey" column="quote_key" />
|
|
<result property="customerId" column="customer_id" />
|
|
<result property="customerCode" column="customer_code" />
|
|
<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="destPostcode" column="dest_postcode" />
|
|
<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="create_time" />
|
|
<result property="updateBy" column="updated_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectPrcQuoteVo">
|
|
select quote_id, quote_key, customer_id, customer_code, product_code, product_name,
|
|
country_code, country_name, dest_postcode, 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, create_time, updated_by, update_time
|
|
from prc_quote
|
|
</sql>
|
|
|
|
<select id="selectPrcQuoteByKey" parameterType="String" resultMap="PrcQuoteResult">
|
|
<include refid="selectPrcQuoteVo"/>
|
|
where quote_key = #{quoteKey}
|
|
</select>
|
|
|
|
<select id="selectPrcQuoteById" parameterType="String" resultMap="PrcQuoteResult">
|
|
<include refid="selectPrcQuoteVo"/>
|
|
where quote_id = #{quoteId}
|
|
</select>
|
|
|
|
<select id="selectPrcQuoteList" parameterType="PrcQuote" resultMap="PrcQuoteResult">
|
|
<include refid="selectPrcQuoteVo"/>
|
|
<where>
|
|
<if test="customerId != null">
|
|
AND customer_id = #{customerId}
|
|
</if>
|
|
<if test="customerCode != null and customerCode != ''">
|
|
AND customer_code = #{customerCode}
|
|
</if>
|
|
<if test="productCode != null and productCode != ''">
|
|
AND product_code like concat('%', #{productCode}, '%')
|
|
</if>
|
|
<if test="productName != null and productName != ''">
|
|
AND product_name like concat('%', #{productName}, '%')
|
|
</if>
|
|
<if test="countryCode != null and countryCode != ''">
|
|
AND country_code = #{countryCode}
|
|
</if>
|
|
<if test="priceSetName != null and priceSetName != ''">
|
|
AND price_set_name like concat('%', #{priceSetName}, '%')
|
|
</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(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
</if>
|
|
<if test="params.endTime != null and params.endTime != ''">
|
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
</if>
|
|
</where>
|
|
order by quote_id desc
|
|
</select>
|
|
|
|
<insert id="insertPrcQuote" parameterType="PrcQuote">
|
|
insert into prc_quote (
|
|
quote_id, quote_key, customer_id, customer_code, product_code, product_name,
|
|
country_code, country_name, dest_postcode, 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,
|
|
create_time
|
|
) values (
|
|
#{quoteId}, #{quoteKey}, #{customerId}, #{customerCode}, #{productCode}, #{productName},
|
|
#{countryCode}, #{countryName}, #{destPostcode}, #{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="updateQuoteAmounts">
|
|
update prc_quote
|
|
set surcharge_amount = #{surchargeAmount},
|
|
payable_total = #{payableTotal},
|
|
update_time = sysdate()
|
|
where quote_id = #{quoteId}
|
|
</update>
|
|
</mapper>
|