修改产品套餐

This commit is contained in:
wuweihua
2026-09-29 23:07:38 +08:00
parent 38f371742a
commit 52d0a13d83
25 changed files with 1229 additions and 351 deletions
@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<id property="psdId" column="psd_id" />
<result property="priceSetId" column="price_set_id" />
<result property="psvId" column="psv_id" />
<result property="pspId" column="psp_id" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="countryCode" column="country_code" />
@@ -35,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectPrcPriceSetDetailVo">
select psd_id, price_set_id, psv_id, product_code, product_name, country_code, country_name,
select psd_id, 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, update_time
@@ -48,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectPrcPriceSetDetailList" parameterType="PrcPriceSetDetail" resultMap="PrcPriceSetDetailResult">
select d.psd_id, d.price_set_id, d.psv_id, d.product_code, d.product_name, d.country_code, d.country_name,
select d.psd_id, d.price_set_id, d.psv_id, d.psp_id, d.product_code, d.product_name, d.country_code, d.country_name,
d.zone_id, d.zone_code, d.zone_name,
d.zd_id, d.wsd_id, d.weight_label, d.weight_min, d.weight_max, d.product_country_id,
d.fv_value, d.fv_registration_fee,
@@ -210,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into prc_price_set_detail (
<if test="priceSetId != null">price_set_id,</if>
<if test="psvId != null">psv_id,</if>
<if test="pspId != null">psp_id,</if>
<if test="productCode != null and productCode != ''">product_code,</if>
<if test="productName != null">product_name,</if>
<if test="countryCode != null">country_code,</if>
@@ -234,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) values (
<if test="priceSetId != null">#{priceSetId},</if>
<if test="psvId != null">#{psvId},</if>
<if test="pspId != null">#{pspId},</if>
<if test="productCode != null and productCode != ''">#{productCode},</if>
<if test="productName != null">#{productName},</if>
<if test="countryCode != null">#{countryCode},</if>
@@ -273,6 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update prc_price_set_detail
<set>
<if test="psvId != null">psv_id = #{psvId},</if>
<if test="pspId != null">psp_id = #{pspId},</if>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="productName != null">product_name = #{productName},</if>
country_code = #{countryCode},
@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.set_type, s.default_discount, s.default_type, s.calculate_sign,
s.status, s.tms_id,
s.created_by, s.create_time, s.updated_by, s.update_time,
(select count(distinct d.product_code) from prc_price_set_detail d where d.price_set_id = s.price_set_id) as product_count,
(select count(distinct p.product_code) from prc_price_set_product p where p.price_set_id = s.price_set_id) as product_count,
(select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count
from prc_price_set s
</sql>
@@ -38,6 +38,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where s.price_set_id = #{priceSetId}
</select>
<select id="selectPrcPriceSetHeaderById" parameterType="Long" resultMap="PrcPriceSetResult">
select s.price_set_id, s.price_set_code, s.price_set_name, s.price_set_note,
s.set_type, s.default_discount, s.default_type, s.calculate_sign,
s.status, s.tms_id,
s.created_by, s.create_time, s.updated_by, s.update_time,
null as product_count, null as customer_count
from prc_price_set s
where s.price_set_id = #{priceSetId}
</select>
<select id="selectPrcPriceSetList" parameterType="PrcPriceSet" resultMap="PrcPriceSetResult">
<include refid="selectPrcPriceSetVo"/>
<where>
@@ -0,0 +1,137 @@
<?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.PrcPriceSetProductMapper">
<resultMap type="PrcPriceSetProduct" id="PrcPriceSetProductResult">
<id property="pspId" column="psp_id" />
<result property="priceSetId" column="price_set_id" />
<result property="psvId" column="psv_id" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="serviceLevel" column="service_level" />
<result property="cargoAttr" column="cargo_attr" />
<result property="destRegion" column="dest_region" />
<result property="updateNote" column="update_note" />
<result property="taxMode" column="tax_mode" />
<result property="sourceProductId" column="source_product_id" />
<result property="sourceSheet" column="source_sheet" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectVo">
select psp_id, price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time, update_time
from prc_price_set_product
</sql>
<select id="selectPrcPriceSetProductById" parameterType="Long" resultMap="PrcPriceSetProductResult">
<include refid="selectVo"/>
where psp_id = #{pspId}
</select>
<select id="selectPrcPriceSetProductList" parameterType="PrcPriceSetProduct" resultMap="PrcPriceSetProductResult">
<include refid="selectVo"/>
<where>
<if test="priceSetId != null">AND price_set_id = #{priceSetId}</if>
<if test="psvId != null">AND psv_id = #{psvId}</if>
<if test="productCode != null and productCode != ''">AND product_code = #{productCode}</if>
</where>
order by product_code asc, psp_id asc
</select>
<select id="selectByPsvIdAndCode" resultMap="PrcPriceSetProductResult">
<include refid="selectVo"/>
where psv_id = #{psvId}
and product_code = #{productCode}
limit 1
</select>
<insert id="insertPrcPriceSetProduct" parameterType="PrcPriceSetProduct" useGeneratedKeys="true" keyProperty="pspId">
insert into prc_price_set_product (
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
) values (
#{priceSetId}, #{psvId}, #{productCode}, #{productName}, #{serviceLevel}, #{cargoAttr},
#{destRegion}, #{updateNote}, #{taxMode}, #{sourceProductId}, #{sourceSheet}, sysdate()
)
</insert>
<update id="updatePrcPriceSetProduct" parameterType="PrcPriceSetProduct">
update prc_price_set_product
<set>
<if test="productName != null">product_name = #{productName},</if>
<if test="serviceLevel != null">service_level = #{serviceLevel},</if>
<if test="cargoAttr != null">cargo_attr = #{cargoAttr},</if>
<if test="destRegion != null">dest_region = #{destRegion},</if>
<if test="updateNote != null">update_note = #{updateNote},</if>
<if test="taxMode != null and taxMode != ''">tax_mode = #{taxMode},</if>
<if test="sourceProductId != null">source_product_id = #{sourceProductId},</if>
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
update_time = sysdate()
</set>
where psp_id = #{pspId}
</update>
<delete id="deleteByPsvId">
delete from prc_price_set_product where psv_id = #{psvId}
</delete>
<delete id="deleteByPsvIdAndCode">
delete from prc_price_set_product
where psv_id = #{psvId}
and product_code = #{productCode}
</delete>
<insert id="copyFromVersion">
insert into prc_price_set_product (
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
)
select
price_set_id, #{newPsvId}, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, sysdate()
from prc_price_set_product
where psv_id = #{srcPsvId}
order by psp_id asc
</insert>
<insert id="insertFromLibrary">
insert ignore into prc_price_set_product (
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
)
select
#{priceSetId},
#{psvId},
p.product_code,
p.product_name,
p.service_level,
p.cargo_attr,
p.dest_region,
p.update_note,
ifnull(p.tax_mode, 'TAX_INCLUDED'),
p.product_id,
p.source_sheet,
sysdate()
from product p
where 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'
)
order by p.product_code asc
</insert>
<update id="bindDetailPspByPsvId">
update prc_price_set_detail d
inner join prc_price_set_product sp
on sp.psv_id = d.psv_id and sp.product_code = d.product_code
set d.psp_id = sp.psp_id
where d.psv_id = #{psvId}
and (d.psp_id is null or d.psp_id &lt;&gt; sp.psp_id)
</update>
</mapper>