Enhance price set import functionality with preview options and update handling. Added new endpoints for previewing product library pulls and Excel imports, along with support for update-only imports. Updated internationalization messages for import success and error scenarios.
This commit is contained in:
@@ -185,6 +185,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by p.product_code asc, c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</insert>
|
||||
|
||||
<select id="selectFixedDetailsFromLibrary" resultMap="PrcPriceSetDetailResult">
|
||||
select
|
||||
null as psd_id,
|
||||
null as price_set_id,
|
||||
null as psv_id,
|
||||
null as psp_id,
|
||||
p.product_code,
|
||||
p.product_name,
|
||||
c.country_code,
|
||||
c.country_name,
|
||||
c.zone_id,
|
||||
c.zone_code,
|
||||
c.zone_name,
|
||||
null as zd_id,
|
||||
null as wsd_id,
|
||||
case
|
||||
when c.weight_min is null and c.weight_max is null then null
|
||||
else concat(
|
||||
ifnull(trim(trailing '0' from trim(trailing '.' from cast(c.weight_min as char))), ''),
|
||||
'<W≤',
|
||||
ifnull(trim(trailing '0' from trim(trailing '.' from cast(c.weight_max as char))), '')
|
||||
)
|
||||
end as weight_label,
|
||||
c.weight_min,
|
||||
c.weight_max,
|
||||
c.detail_id as product_country_id,
|
||||
c.freight_price as fv_value,
|
||||
c.registration_fee as fv_registration_fee,
|
||||
null as base_freight_price,
|
||||
null as base_registration_fee,
|
||||
null as discount_value,
|
||||
'HALF_UP' as round_mode,
|
||||
null as pr_id,
|
||||
c.effective_date,
|
||||
c.expire_date,
|
||||
null as create_time,
|
||||
null as update_time
|
||||
from product_country c
|
||||
inner join product p on p.product_id = c.product_id
|
||||
<where>
|
||||
and p.status = '1'
|
||||
and p.product_id = (
|
||||
select max(p2.product_id) from product p2
|
||||
where p2.product_code = p.product_code and p2.status = '1'
|
||||
)
|
||||
and ifnull(c.status, '1') <> '2'
|
||||
<choose>
|
||||
<when test="openOnly">
|
||||
and (c.effective_date is null or date(c.effective_date) <= curdate())
|
||||
and (c.expire_date is null or date(c.expire_date) > curdate())
|
||||
</when>
|
||||
<otherwise>
|
||||
and date(c.effective_date) <= date(#{asOf})
|
||||
and (c.expire_date is null or date(c.expire_date) > date(#{asOf}))
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
order by p.product_code asc, c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertDiscountDetailsFromLibrary">
|
||||
insert ignore into prc_price_set_detail (
|
||||
price_set_id, psv_id, product_code, product_name, round_mode, create_time
|
||||
@@ -261,6 +321,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertPrcPriceSetDetailBatch" useGeneratedKeys="true" keyProperty="psdId">
|
||||
insert into prc_price_set_detail (
|
||||
price_set_id, psv_id, psp_id, product_code, product_name,
|
||||
country_code, country_name, zone_id, zone_code, zone_name,
|
||||
zd_id, wsd_id, weight_label, weight_min, weight_max, product_country_id,
|
||||
fv_value, fv_registration_fee, discount_value, round_mode, pr_id,
|
||||
effective_date, expire_date, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.priceSetId}, #{item.psvId}, #{item.pspId}, #{item.productCode}, #{item.productName},
|
||||
#{item.countryCode}, #{item.countryName}, #{item.zoneId}, #{item.zoneCode}, #{item.zoneName},
|
||||
#{item.zdId}, #{item.wsdId}, #{item.weightLabel}, #{item.weightMin}, #{item.weightMax}, #{item.productCountryId},
|
||||
#{item.fvValue}, #{item.fvRegistrationFee}, #{item.discountValue},
|
||||
ifnull(#{item.roundMode}, 'HALF_UP'), #{item.prId},
|
||||
#{item.effectiveDate}, #{item.expireDate}, sysdate()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- Null means keep existing value (import empty freight/registration skips overwrite). -->
|
||||
<update id="updateDetailPrices">
|
||||
update prc_price_set_detail
|
||||
|
||||
Reference in New Issue
Block a user