增加试算功能

This commit is contained in:
wuweihua
2026-09-07 14:42:27 +08:00
parent a083a0dece
commit ea2bc6f33e
17 changed files with 1060 additions and 0 deletions
@@ -69,4 +69,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectMatchByProductCountryWeight" resultMap="BmsProductCountryResult">
select detail_id, product_code, country_name, country_code, weight_min, weight_max,
freight_price, registration_fee, size_limit, last_mile, lead_time,
effective_date, created_at, updated_at
from bms_product_country
where product_code = #{productCode}
and weight_min &lt;= #{weight}
and weight_max &gt;= #{weight}
<choose>
<when test="countryCode != null and countryCode != ''">
and upper(country_code) = upper(#{countryCode})
</when>
<when test="countryName != null and countryName != ''">
and country_name = #{countryName}
</when>
<otherwise>
and 1 = 0
</otherwise>
</choose>
order by weight_min asc, detail_id asc
limit 1
</select>
</mapper>
@@ -64,6 +64,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ifnull(c.pr_enddate, '9999-12-31') &gt;= #{beginDate}
</select>
<select id="selectEffectiveByCustomer" resultMap="PrcCustomerPriceSetResult">
select c.customer_priceset_id, c.price_set_id, c.customer_id, c.customer_name, c.bind_priority,
c.pr_begindate, c.pr_enddate, c.price_set_note,
c.created_by, c.created_at, c.updated_by, c.updated_at
from prc_customer_price_set c
inner join prc_price_set s on s.price_set_id = c.price_set_id
where c.customer_id = #{customerId}
and s.status = 'E'
and c.pr_begindate &lt;= #{bizDate}
and ifnull(c.pr_enddate, '9999-12-31') &gt;= #{bizDate}
order by c.bind_priority asc, c.pr_begindate desc, c.customer_priceset_id asc
</select>
<insert id="insertPrcCustomerPriceSet" parameterType="PrcCustomerPriceSet" useGeneratedKeys="true" keyProperty="customerPricesetId">
insert into prc_customer_price_set (
<if test="priceSetId != null">price_set_id,</if>
@@ -124,4 +124,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from prc_price_set_detail where price_set_id = #{priceSetId}
</delete>
<select id="selectFixedMatch" resultMap="PrcPriceSetDetailResult">
<include refid="selectPrcPriceSetDetailVo"/>
where price_set_id = #{priceSetId}
and product_code = #{productCode}
and (
<if test="productCountryId != null">
product_country_id = #{productCountryId}
or
</if>
(
<choose>
<when test="countryCode != null and countryCode != ''">
upper(ifnull(country_code,'')) = upper(#{countryCode})
</when>
<when test="countryName != null and countryName != ''">
country_name = #{countryName}
</when>
<otherwise>
1 = 0
</otherwise>
</choose>
<if test="weightLabel != null and weightLabel != ''">
and (weight_label is null or weight_label = #{weightLabel} or weight_label like concat('%', #{weightLabel}, '%'))
</if>
)
)
order by
case when #{productCountryId} is not null and product_country_id = #{productCountryId} then 0 else 1 end,
psd_id asc
limit 1
</select>
<select id="selectDiscountMatch" resultMap="PrcPriceSetDetailResult">
<include refid="selectPrcPriceSetDetailVo"/>
where price_set_id = #{priceSetId}
and product_code = #{productCode}
order by psd_id asc
limit 1
</select>
</mapper>