优化导入逻辑
This commit is contained in:
@@ -71,7 +71,7 @@ public interface PrcPriceSetDetailMapper
|
|||||||
@Param("psvId") Long psvId,
|
@Param("psvId") Long psvId,
|
||||||
@Param("productCode") String productCode);
|
@Param("productCode") String productCode);
|
||||||
|
|
||||||
/** Update package freight / registration only */
|
/** Update package freight / registration; null args keep existing columns. */
|
||||||
public int updateDetailPrices(
|
public int updateDetailPrices(
|
||||||
@Param("psdId") Long psdId,
|
@Param("psdId") Long psdId,
|
||||||
@Param("fvValue") BigDecimal fvValue,
|
@Param("fvValue") BigDecimal fvValue,
|
||||||
|
|||||||
+16
-3
@@ -917,9 +917,22 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
detailMapper.updateDetailPrices(hit.getPsdId(), row.getFreightPrice(), row.getRegistrationFee());
|
// Empty import freight/registration: do not overwrite existing detail values.
|
||||||
hit.setFvValue(row.getFreightPrice());
|
BigDecimal freight = row.getFreightPrice();
|
||||||
hit.setFvRegistrationFee(row.getRegistrationFee());
|
BigDecimal registration = row.getRegistrationFee();
|
||||||
|
if (freight == null && registration == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
detailMapper.updateDetailPrices(hit.getPsdId(), freight, registration);
|
||||||
|
if (freight != null)
|
||||||
|
{
|
||||||
|
hit.setFvValue(freight);
|
||||||
|
}
|
||||||
|
if (registration != null)
|
||||||
|
{
|
||||||
|
hit.setFvRegistrationFee(registration);
|
||||||
|
}
|
||||||
touched.add(hit.getPsdId());
|
touched.add(hit.getPsdId());
|
||||||
updated++;
|
updated++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,11 +258,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<!-- Null means keep existing value (import empty freight/registration skips overwrite). -->
|
||||||
<update id="updateDetailPrices">
|
<update id="updateDetailPrices">
|
||||||
update prc_price_set_detail
|
update prc_price_set_detail
|
||||||
set fv_value = #{fvValue},
|
<set>
|
||||||
fv_registration_fee = #{fvRegistrationFee},
|
<if test="fvValue != null">fv_value = #{fvValue},</if>
|
||||||
|
<if test="fvRegistrationFee != null">fv_registration_fee = #{fvRegistrationFee},</if>
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
where psd_id = #{psdId}
|
where psd_id = #{psdId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user