Refactor surcharge management by replacing PrcPriceSetVersionSurcharge with PrcSurchargeRel, introducing price type handling (PRODUCT, SALES, REDLINE) and updating related services, mappers, and front-end components. Enhance validation and error messaging for price type and detail ID requirements. Update database schema to support new relationships and constraints.
This commit is contained in:
@@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="detailId" column="detail_id" />
|
||||
<result property="priceType" column="price_type" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
@@ -17,7 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
@@ -30,13 +31,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectPrcSurchargeRelVo">
|
||||
select r.rel_id, r.sc_id, r.product_id, r.product_code, r.detail_id,
|
||||
r.price_type, r.country_code,
|
||||
r.created_by, r.create_time, r.updated_by, r.update_time,
|
||||
s.sc_name, s.fee_type, s.charge_type, s.charge_value, s.currency,
|
||||
s.round_mode, s.ss_code, s.country_code, s.sc_note,
|
||||
s.round_mode, s.ss_code, s.sc_note,
|
||||
c.country_name, c.weight_min, c.weight_max
|
||||
from prc_surcharge_rel r
|
||||
join prc_surcharge s on s.sc_id = r.sc_id
|
||||
left join product_country c on c.detail_id = r.detail_id
|
||||
and r.price_type in ('PRODUCT', 'REDLINE')
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcSurchargeRelList" parameterType="PrcSurchargeRel" resultMap="PrcSurchargeRelResult">
|
||||
@@ -51,17 +54,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="scId != null">
|
||||
AND r.sc_id = #{scId}
|
||||
</if>
|
||||
<if test="detailId != null">
|
||||
AND r.detail_id = #{detailId}
|
||||
</if>
|
||||
<if test="priceType != null and priceType != ''">
|
||||
AND r.price_type = #{priceType}
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND r.country_code = #{countryCode}
|
||||
</if>
|
||||
</where>
|
||||
order by r.detail_id is not null, r.rel_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectByDetailIdsAndPriceType" resultMap="PrcSurchargeRelResult">
|
||||
<include refid="selectPrcSurchargeRelVo"/>
|
||||
where r.price_type = #{priceType}
|
||||
and r.detail_id in
|
||||
<foreach item="id" collection="detailIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by r.rel_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcSurchargeRel" parameterType="PrcSurchargeRel" useGeneratedKeys="true" keyProperty="relId">
|
||||
insert into prc_surcharge_rel (
|
||||
sc_id, product_id, product_code, detail_id,
|
||||
sc_id, product_id, product_code, detail_id, price_type, country_code,
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
#{scId}, #{productId}, #{productCode}, #{detailId},
|
||||
#{priceType}, #{countryCode},
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
@@ -79,6 +102,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach item="code" collection="array" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
and price_type in ('PRODUCT', 'REDLINE')
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByDetailIdsAndPriceType">
|
||||
delete from prc_surcharge_rel
|
||||
where price_type = #{priceType}
|
||||
and detail_id in
|
||||
<foreach item="id" collection="detailIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductIdsAndPriceType">
|
||||
delete from prc_surcharge_rel
|
||||
where price_type = #{priceType}
|
||||
and product_id in
|
||||
<foreach item="id" collection="productIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 附加费版本化编辑后,产品关联重指向新记录 -->
|
||||
|
||||
Reference in New Issue
Block a user