应付邮编调整和订单应付计费的附加费调整

This commit is contained in:
liuminghui
2026-11-19 11:09:44 +08:00
parent a0b9b58291
commit ad7cf3c18c
23 changed files with 752 additions and 70 deletions
@@ -60,6 +60,31 @@
and g.country_name = #{countryName}
</otherwise>
</choose>
<include refid="channelMatch"/>
</sql>
<sql id="lineChannelMatch">
<choose>
<when test="channelName != null and channelName != ''">
and lower(trim(g.channel_name)) = lower(trim(#{channelName}))
</when>
<otherwise>
and (g.channel_name is null or trim(g.channel_name) = '')
</otherwise>
</choose>
</sql>
<sql id="channelMatch">
<if test="allChannels == null or !allChannels">
<choose>
<when test="channelName != null and channelName != ''">
and lower(trim(g.channel_name)) = lower(trim(#{channelName}))
</when>
<otherwise>
and (g.channel_name is null or trim(g.channel_name) = '')
</otherwise>
</choose>
</if>
</sql>
<sql id="zoneExpr">
@@ -79,19 +104,23 @@
group_concat(distinct nullif(trim(g.service_type), '') order by g.service_type separator '、') as serviceType,
group_concat(distinct nullif(trim(g.product_name), '') order by g.product_name separator '、') as productName,
group_concat(distinct nullif(trim(g.channel_name), '') order by g.channel_name separator '、') as channelName,
count(distinct
case
when l.line_id is not null then
case
when nullif(trim(l.zone_name), '') is not null then trim(l.zone_name)
when nullif(trim(l.region_name), '') is not null then trim(l.region_name)
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
else '未分区'
end
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
else null
end
) as zoneCount,
count(distinct case
when l.line_id is null and nullif(trim(g.block_title), '') is null then null
else concat(
case
when l.line_id is not null then
case
when nullif(trim(l.zone_name), '') is not null then trim(l.zone_name)
when nullif(trim(l.region_name), '') is not null then trim(l.region_name)
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
else '未分区'
end
else trim(g.block_title)
end,
'||',
lower(ifnull(trim(g.channel_name), ''))
)
end) as zoneCount,
count(l.line_id) as lineCount,
max(g.create_time) as createTime
from pay_postcode_group g
@@ -125,9 +154,10 @@
group_concat(distinct nullif(trim(t.coverage), '') order by t.coverage separator '、') as coverage,
count(t.line_id) as lineCount,
max(t.country_name) as countryName,
max(t.country_code) as countryCode
max(t.country_code) as countryCode,
max(t.channel_name) as channelName
from (
select g.group_id, g.coverage, g.country_name, g.country_code, l.line_id,
select g.group_id, g.coverage, g.country_name, g.country_code, g.channel_name, l.line_id,
case
when l.line_id is null then nullif(trim(g.block_title), '')
else
@@ -145,8 +175,12 @@
</where>
) t
where t.zone_name is not null and t.zone_name &lt;&gt; ''
group by t.zone_name
order by t.zone_name asc
group by t.zone_name,
case
when nullif(trim(t.channel_name), '') is not null then lower(trim(t.channel_name))
else ''
end
order by t.zone_name asc, max(t.channel_name) asc
</select>
<select id="selectSampleGroup" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
@@ -196,10 +230,17 @@
<update id="updateCountryProfile" parameterType="com.bms.price.domain.PayPostcodeGroup">
update pay_postcode_group g
set g.service_type = #{serviceType},
g.product_name = #{productName},
g.channel_name = #{channelName}
g.product_name = #{productName}
<where>
<include refid="countryMatch"/>
<choose>
<when test="countryCode != null and countryCode != ''">
and upper(trim(g.country_code)) = upper(trim(#{countryCode}))
</when>
<otherwise>
and (g.country_code is null or trim(g.country_code) = '')
and g.country_name = #{countryName}
</otherwise>
</choose>
</where>
</update>
@@ -325,13 +366,16 @@
</if>
<if test="countryCode != null and countryCode != ''">
and l.group_id in (
select g.group_id from pay_postcode_group g where upper(trim(g.country_code)) = upper(trim(#{countryCode}))
select g.group_id from pay_postcode_group g
where upper(trim(g.country_code)) = upper(trim(#{countryCode}))
<include refid="lineChannelMatch"/>
)
</if>
<if test="(countryCode == null or countryCode == '') and countryName != null and countryName != ''">
and l.group_id in (
select g.group_id from pay_postcode_group g
where (g.country_code is null or trim(g.country_code) = '') and g.country_name = #{countryName}
<include refid="lineChannelMatch"/>
)
</if>
</where>
@@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.bind_id as bindId, b.product_id as productId, b.product_type as productType, b.sc_id as scId, b.sort_no as sortNo,
b.created_by as createdBy, b.create_time as createTime, b.updated_by as updatedBy, b.update_time as updateTime,
c.sc_name as scName, c.charge_type as chargeType, c.charge_value as chargeValue, c.currency, c.ss_code as ssCode,
c.block_title as blockTitle, c.sc_note as scNote,
c.block_title as blockTitle, c.sc_note as scNote, c.country_code as countryCode, c.fee_type as feeType,
c.length_cm as lengthCm, c.width_cm as widthCm, c.height_cm as heightCm,
c.over_weight_kg as overWeightKg, c.extra_weight_kg as extraWeightKg, c.postcode_text as postcodeText
</sql>