Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="BmsProductCountry" id="BmsProductCountryResult">
|
||||
<id property="detailId" column="detail_id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
@@ -18,20 +19,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="leadTime" column="lead_time" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
<result property="effectStatus" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select detail_id, product_code, country_name, country_code, weight_min, weight_max,
|
||||
select detail_id, product_id, product_code, country_name, country_code, weight_min, weight_max,
|
||||
freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
effective_date, expire_date, created_at, updated_at
|
||||
effective_date, expire_date, status, created_at, updated_at
|
||||
from bms_product_country
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsProductCountryList" parameterType="BmsProductCountry" resultMap="BmsProductCountryResult">
|
||||
<include refid="selectVo"/>
|
||||
<where>
|
||||
<if test="productId != null">
|
||||
AND product_id = #{productId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code = #{productCode}
|
||||
</if>
|
||||
@@ -53,22 +59,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="openOnly != null and openOnly">
|
||||
AND expire_date is null
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
AND status = #{effectStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by effective_date desc, country_name asc, weight_min asc, detail_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsProductCountry" parameterType="BmsProductCountry" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into bms_product_country (
|
||||
product_code, country_name, country_code, weight_min, weight_max,
|
||||
product_id, product_code, country_name, country_code, weight_min, weight_max,
|
||||
freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
effective_date, expire_date, created_at
|
||||
effective_date, expire_date, status, created_at
|
||||
) values (
|
||||
#{productCode}, #{countryName}, #{countryCode}, #{weightMin}, #{weightMax},
|
||||
#{productId}, #{productCode}, #{countryName}, #{countryCode}, #{weightMin}, #{weightMax},
|
||||
#{freightPrice}, #{registrationFee}, #{sizeLimit}, #{lastMile}, #{leadTime},
|
||||
#{effectiveDate}, #{expireDate}, sysdate()
|
||||
#{effectiveDate}, #{expireDate}, IFNULL(#{status}, '0'), sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByProductId" parameterType="Long">
|
||||
delete from bms_product_country where product_id = #{productId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCode" parameterType="String">
|
||||
delete from bms_product_country where product_code = #{productCode}
|
||||
</delete>
|
||||
@@ -80,6 +96,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCodeAndEffectiveDate">
|
||||
delete from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
and (
|
||||
(#{effectiveDate} is null and effective_date is null)
|
||||
or effective_date = #{effectiveDate}
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="selectMaxOpenEffectiveDate" resultType="java.util.Date">
|
||||
select max(effective_date) from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
@@ -95,6 +120,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
</update>
|
||||
|
||||
<update id="refreshStatusByDates">
|
||||
update bms_product_country
|
||||
set status = case
|
||||
when expire_date is not null and expire_date <= curdate() then '2'
|
||||
when effective_date is null or effective_date > curdate() then '0'
|
||||
else '1'
|
||||
end
|
||||
</update>
|
||||
|
||||
<delete id="deleteOpenByProductCodeAndEffectiveDate">
|
||||
delete from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
|
||||
@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateNote" column="update_note" />
|
||||
<result property="taxMode" column="tax_mode" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="sourceSheet" column="source_sheet" />
|
||||
<result property="remark" column="remark" />
|
||||
@@ -28,9 +29,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectBmsProductVo">
|
||||
select p.product_id, p.product_code, p.product_name, p.service_level, p.cargo_attr,
|
||||
p.dest_region, p.update_note, p.tax_mode, p.effective_date, p.status,
|
||||
p.dest_region, p.update_note, p.tax_mode, p.effective_date, p.expire_date, p.status,
|
||||
p.source_sheet, p.remark, p.tms_id, p.created_by, p.created_at, p.updated_by, p.updated_at,
|
||||
(select count(distinct c.country_name) from bms_product_country c where c.product_code = p.product_code) as country_count,
|
||||
(select count(distinct c.country_name) from bms_product_country c
|
||||
where c.product_id = p.product_id
|
||||
or (c.product_id is null and c.product_code = p.product_code
|
||||
and (
|
||||
(p.effective_date is null and c.effective_date is null)
|
||||
or c.effective_date = p.effective_date
|
||||
))
|
||||
) as country_count,
|
||||
(select count(*) from prc_surcharge_rel r where r.product_id = p.product_id) as surcharge_count
|
||||
from bms_product p
|
||||
</sql>
|
||||
@@ -43,6 +51,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectBmsProductByCode" parameterType="String" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
order by p.effective_date desc, p.product_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBmsProductByCodeAndDate" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
<choose>
|
||||
<when test="effectiveDate != null">
|
||||
AND p.effective_date = #{effectiveDate}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND p.effective_date is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectEffectiveBmsProductByCode" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
and (p.effective_date is null or #{bizDate} is null or p.effective_date <= #{bizDate})
|
||||
and (p.expire_date is null or #{bizDate} is null or p.expire_date > #{bizDate})
|
||||
order by p.effective_date desc, p.product_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBmsProductList" parameterType="BmsProduct" resultMap="BmsProductResult">
|
||||
@@ -61,20 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND p.status = #{status}
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
<choose>
|
||||
<when test="effectStatus == 'EXPIRED'">
|
||||
AND p.status = '1'
|
||||
</when>
|
||||
<when test="effectStatus == 'PENDING'">
|
||||
AND p.status = '0'
|
||||
AND (p.effective_date is null or p.effective_date > curdate())
|
||||
</when>
|
||||
<when test="effectStatus == 'ACTIVE'">
|
||||
AND p.status = '0'
|
||||
AND p.effective_date is not null
|
||||
AND p.effective_date <= curdate()
|
||||
</when>
|
||||
</choose>
|
||||
AND p.status = #{effectStatus}
|
||||
</if>
|
||||
<if test="cargoAttr != null and cargoAttr != ''">
|
||||
AND p.cargo_attr like concat('%', #{cargoAttr}, '%')
|
||||
@@ -84,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
OR p.product_name like concat('%', #{params.keyword}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
order by p.product_id desc
|
||||
order by p.product_code asc, p.effective_date desc, p.product_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsProduct" parameterType="BmsProduct" useGeneratedKeys="true" keyProperty="productId">
|
||||
@@ -97,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateNote != null">update_note,</if>
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode,</if>
|
||||
<if test="effectiveDate != null">effective_date,</if>
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="sourceSheet != null">source_sheet,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
@@ -112,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateNote != null">#{updateNote},</if>
|
||||
<if test="taxMode != null and taxMode != ''">#{taxMode},</if>
|
||||
<if test="effectiveDate != null">#{effectiveDate},</if>
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="sourceSheet != null">#{sourceSheet},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
@@ -132,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateNote != null">update_note = #{updateNote},</if>
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode = #{taxMode},</if>
|
||||
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
|
||||
expire_date = #{expireDate},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
@@ -149,4 +172,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="expireOpenByProductCode">
|
||||
update bms_product
|
||||
set expire_date = #{newEffectiveDate},
|
||||
updated_at = sysdate()
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
<if test="excludeId != null">
|
||||
and product_id <> #{excludeId}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="refreshStatusByDates">
|
||||
update bms_product
|
||||
set status = case
|
||||
when expire_date is not null and expire_date <= curdate() then '2'
|
||||
when effective_date is null or effective_date > curdate() then '0'
|
||||
else '1'
|
||||
end
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -51,6 +51,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from prc_customer_price_set where price_set_id = #{priceSetId}
|
||||
</select>
|
||||
|
||||
<select id="countByCustomerId" resultType="int">
|
||||
select count(1) from prc_customer_price_set
|
||||
where customer_id = #{customerId}
|
||||
<if test="excludeId != null">
|
||||
AND customer_priceset_id <> #{excludeId}
|
||||
</if>
|
||||
<if test="excludePriceSetId != null">
|
||||
AND price_set_id <> #{excludePriceSetId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countOverlap" resultType="int">
|
||||
select count(1)
|
||||
from prc_customer_price_set c
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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.PrcQuoteFeeMapper">
|
||||
|
||||
<resultMap type="PrcQuoteFee" id="PrcQuoteFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="quoteId" column="quote_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="feeName" column="fee_name" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByQuoteId" parameterType="Long" resultMap="PrcQuoteFeeResult">
|
||||
select fee_id, quote_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, created_at
|
||||
from prc_quote_fee
|
||||
where quote_id = #{quoteId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE'), fee_id
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcQuoteFee" parameterType="PrcQuoteFee" useGeneratedKeys="true" keyProperty="feeId">
|
||||
insert into prc_quote_fee (
|
||||
quote_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, created_at
|
||||
) values (
|
||||
#{quoteId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
insert into prc_quote_fee (
|
||||
quote_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, created_at
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.quoteId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByQuoteId" parameterType="Long">
|
||||
delete from prc_quote_fee where quote_id = #{quoteId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,132 @@
|
||||
<?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.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="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="selectPrcQuoteVo">
|
||||
select quote_id, quote_key, customer_id, 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_quote
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcQuoteByKey" parameterType="String" resultMap="PrcQuoteResult">
|
||||
<include refid="selectPrcQuoteVo"/>
|
||||
where quote_key = #{quoteKey}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcQuoteById" parameterType="Long" 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="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(created_at,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND date_format(created_at,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by quote_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcQuote" parameterType="PrcQuote" useGeneratedKeys="true" keyProperty="quoteId">
|
||||
insert into prc_quote (
|
||||
quote_key, customer_id, 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 (
|
||||
#{quoteKey}, #{customerId}, #{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="updateQuoteAmounts">
|
||||
update prc_quote
|
||||
set surcharge_amount = #{surchargeAmount},
|
||||
payable_total = #{payableTotal},
|
||||
updated_at = sysdate()
|
||||
where quote_id = #{quoteId}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user