获取服务信息

This commit is contained in:
xuelijun
2025-08-27 09:12:34 +08:00
parent 4711bb8cbc
commit ecb8f31850
11 changed files with 211 additions and 226 deletions

View File

@@ -38,7 +38,7 @@
<collection property="prodEmergencyResponseIntervalsList" ofType="com.tashow.cloud.productapi.api.product.dto.ProdEmergencyResponseIntervalsDO">
<id property="id" column="eri_record_id"/>
<result property="configId" column="eri_config_id"/>
<result property="modeName" column="mode_name"/>
<result property="name" column="eri_name"/>
<result property="responseHours" column="response_hours"/>
<result property="chargeMode" column="charge_mode"/>
<result property="floatingPercentage" column="floating_percentage"/>
@@ -168,7 +168,7 @@
<collection property="prodEmergencyResponseIntervalsList" ofType="com.tashow.cloud.productapi.api.product.dto.ProdEmergencyResponseIntervalsDO">
<id property="id" column="eri_record_id"/>
<result property="configId" column="eri_config_id"/>
<result property="modeName" column="mode_name"/>
<result property="name" column="eri_name"/>
<result property="responseHours" column="response_hours"/>
<result property="chargeMode" column="charge_mode"/>
<result property="floatingPercentage" column="floating_percentage"/>
@@ -257,148 +257,135 @@
<!-- 动态SQL查询商品列表及其服务配置 (返回 List<ProdServiceVO>) -->
<!-- 用于列表页,可根据开关动态决定是否关联紧急响应信息以优化性能 -->
<select id="selectProdService" parameterType="map" resultMap="ProdServiceResultMap">
SELECT
p.prod_id,
p.emergency_switch,
p.additional_switch,
p.additional_fee_switch,
p.reservation_switch,
p.order_limit_switch,
p.weight_switch,
p.region_switch,
p.create_time,
p.update_time,
p.creator,
p.updater,
p.category_name,
<!-- 只有当 emergencySwitch 开启时,才查询紧急响应相关字段 -->
<if test="emergencySwitch != null and emergencySwitch == 1">
erc.id AS erc_record_id,
erc.response_time_slots as erc_response_time_slots,
SELECT p.prod_id,
p.emergency_switch,
p.additional_switch,
p.additional_fee_switch,
p.reservation_switch,
p.order_limit_switch,
p.weight_switch,
p.region_switch,
p.create_time,
p.update_time,
p.creator,
p.updater,
p.category_name,
epafd.id AS eblack_record_id,
epafd.date_type as eblack_date_type,
epafd.custom_time_slots as eblack_custom_time_slots,
epafd.type as eblack_type,
epafd.is_enabled as eblack_is_enabled,
erc.id AS erc_record_id,
erc.response_time_slots as erc_response_time_slots,
eri.id AS eri_record_id,
eri.config_id AS eri_config_id,
eri.mode_name,
eri.response_hours,
eri.charge_mode,
eri.floating_percentage,
eri.price,
eri.create_time AS eri_create_time,
eri.update_time AS eri_update_time,
eri.creator AS eri_creator,
eri.updater AS eri_updater,
eri.deleted AS eri_deleted,
</if>
<!-- 只有当 additionalFeeSwitch 开启时,才查询特殊日期规则相关字段 -->
<if test="additionalFeeSwitch != null and additionalFeeSwitch == 1">
afp.id AS afp_record_id,
afp.prod_id AS afp_prod_id,
afp.name AS afp_name,
afp.special_time_slots AS afp_special_time_slots,
afp.charge_mode AS afp_charge_mode,
afp.price AS afp_price,
afp.floating_percentage AS afp_floating_percentage,
</if>
<!-- 只有当 additionalSwitch 开启时,才查询特殊时段规则相关字段 -->
<if test="additionalSwitch != null and additionalSwitch == 1">
afd.id AS afd_record_id,
afd.prod_id AS afd_prod_id,
afd.name AS afd_name,
afd.date_type AS afd_date_type,
afd.custom_time_slots AS afd_custom_time_slots,
afd.specific_dates AS afd_specific_dates,
afd.charge_mode AS afd_charge_mode,
afd.price AS afd_price,
afd.is_enabled AS afd_is_enabled,
afd.create_time AS afd_create_time,
afd.update_time AS afd_update_time,
afd.creator AS afd_creator,
afd.updater AS afd_updater,
afd.deleted AS afd_deleted,
</if>
<!-- 只有当 reservationSwitch 开启时,才查询预约配置相关字段 -->
<if test="reservationSwitch != null and reservationSwitch == 1">
rc.id AS rc_record_id,
rc.prod_id AS rc_prod_id,
rc.reservation_time_slots AS rc_reservation_time_slots,
rc.advance_hours AS rc_advance_hours,
rc.reservation_date_range AS rc_reservation_date_range,
rc.allow_change AS rc_allow_change,
rc.change_time_rule AS rc_change_time_rule,
rc.time_slot AS rc_time_slot,
rc.max_change_times AS rc_max_change_times,
epafd.id AS eblack_record_id,
epafd.date_type as eblack_date_type,
epafd.custom_time_slots as eblack_custom_time_slots,
epafd.type as eblack_type,
epafd.is_enabled as eblack_is_enabled,
rpafd.id AS black_id,
rpafd.date_type as black_date_type,
rpafd.custom_time_slots as black_custom_time_slots,
rpafd.type as black_type,
rpafd.is_enabled as black_is_enabled,
eri.id AS eri_record_id,
eri.config_id AS eri_config_id,
eri.name as eri_name,
eri.response_hours,
eri.charge_mode,
eri.floating_percentage,
eri.price,
eri.create_time AS eri_create_time,
eri.update_time AS eri_update_time,
eri.creator AS eri_creator,
eri.updater AS eri_updater,
eri.deleted AS eri_deleted,
</if>
<!-- 只有当 orderLimitSwitch 开启时,才查询接单上限配置相关字段 -->
<if test="orderLimitSwitch != null and orderLimitSwitch == 1">
ol.id AS ol_record_id,
ol.prod_id AS ol_prod_id,
ol.limit_unit AS ol_limit_unit,
ol.max_orders AS ol_max_orders,
</if>
<!-- 只有当 weightSwitch 开启时,才查询体重区间价格相关字段 -->
<if test="weightSwitch != null and weightSwitch == 1">
tpe.is_weight_charge as tpe_is_weight_charge,
wrp.id AS wrp_record_id,
wrp.prod_id AS wrp_prod_id,
wrp.weight_range AS wrp_weight_range,
wrp.price AS wrp_price,
wrp.is_enabled AS wrp_is_enabled,
</if>
<!-- 只有当 regionSwitch 开启时,才查询服务区域相关字段 -->
<if test="regionSwitch != null and regionSwitch == 1">
sa.id AS sa_rule_id,
sa.prod_id AS sa_prod_id,
sa.rule_type AS sa_rule_type,
sa.fee AS sa_fee,
saa.area_name AS sa_area_name,
</if>
p.prod_name
FROM
tz_prod p
<!-- 只有当 emergencySwitch 开启时才进行 LEFT JOIN -->
<if test="emergencySwitch != null and emergencySwitch == 1">
LEFT JOIN tz_prod_emergency_response erc ON p.prod_id = erc.prod_id AND erc.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates epafd ON p.prod_id = epafd.prod_id AND epafd.deleted = 0 AND epafd.type = 3
LEFT JOIN tz_prod_emergency_response_intervals eri ON erc.id = eri.config_id AND eri.deleted = 0
</if>
<if test="additionalFeeSwitch != null and additionalFeeSwitch == 1">
LEFT JOIN tz_prod_additional_fee_periods afp ON p.prod_id = afp.prod_id AND afp.deleted = 0
</if>
<if test="additionalSwitch != null and additionalSwitch == 1">
LEFT JOIN tz_prod_additional_fee_dates afd ON p.prod_id = afd.prod_id AND afd.deleted = 0 and afd.type = 1
</if>
<if test="reservationSwitch != null and reservationSwitch == 1">
LEFT JOIN tz_prod_reservation_config rc ON p.prod_id = rc.prod_id AND rc.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates rpafd ON p.prod_id = rpafd.prod_id AND rpafd.deleted = 0 AND rpafd.type = 2
</if>
<if test="orderLimitSwitch != null and orderLimitSwitch == 1">
LEFT JOIN tz_product_order_limit ol ON p.prod_id = ol.prod_id AND ol.deleted = 0
</if>
<if test="weightSwitch != null and weightSwitch == 1">
LEFT JOIN tz_prod_extend tpe ON p.prod_id = tpe.prod_id
LEFT JOIN tz_prod_weight_range_prices wrp ON p.prod_id = wrp.prod_id AND wrp.deleted = 0
</if>
<if test="regionSwitch != null and regionSwitch == 1">
LEFT JOIN tz_prod_service_over_area_rules sa ON p.prod_id = sa.prod_id AND sa.deleted = 0
LEFT JOIN tz_prod_service_area_relevance sar ON p.prod_id = sar.prod_id
LEFT JOIN tz_prod_service_areas saa ON sar.area_id = saa.id AND saa.deleted = 0
</if>
where p.deleted = 0
AND p.prod_id = #{prodId}
ORDER BY p.prod_id
afp.id AS afp_record_id,
afp.prod_id AS afp_prod_id,
afp.name AS afp_name,
afp.special_time_slots AS afp_special_time_slots,
afp.charge_mode AS afp_charge_mode,
afp.price AS afp_price,
afp.floating_percentage AS afp_floating_percentage,
afd.id AS afd_record_id,
afd.prod_id AS afd_prod_id,
afd.name AS afd_name,
afd.date_type AS afd_date_type,
afd.custom_time_slots AS afd_custom_time_slots,
afd.specific_dates AS afd_specific_dates,
afd.charge_mode AS afd_charge_mode,
afd.price AS afd_price,
afd.is_enabled AS afd_is_enabled,
afd.create_time AS afd_create_time,
afd.update_time AS afd_update_time,
afd.creator AS afd_creator,
afd.updater AS afd_updater,
afd.deleted AS afd_deleted,
rc.id AS rc_record_id,
rc.prod_id AS rc_prod_id,
rc.reservation_time_slots AS rc_reservation_time_slots,
rc.advance_hours AS rc_advance_hours,
rc.reservation_date_range AS rc_reservation_date_range,
rc.allow_change AS rc_allow_change,
rc.change_time_rule AS rc_change_time_rule,
rc.time_slot AS rc_time_slot,
rc.max_change_times AS rc_max_change_times,
rpafd.id AS black_id,
rpafd.date_type as black_date_type,
rpafd.custom_time_slots as black_custom_time_slots,
rpafd.type as black_type,
rpafd.is_enabled as black_is_enabled,
ol.id AS ol_record_id,
ol.prod_id AS ol_prod_id,
ol.limit_unit AS ol_limit_unit,
ol.max_orders AS ol_max_orders,
tpe.is_weight_charge as tpe_is_weight_charge,
wrp.id AS wrp_record_id,
wrp.prod_id AS wrp_prod_id,
wrp.weight_range AS wrp_weight_range,
wrp.price AS wrp_price,
wrp.is_enabled AS wrp_is_enabled,
sa.id AS sa_rule_id,
sa.prod_id AS sa_prod_id,
sa.rule_type AS sa_rule_type,
sa.fee AS sa_fee,
saa.area_name AS sa_area_name,
p.prod_name
FROM tz_prod p
LEFT JOIN tz_prod_emergency_response erc ON p.prod_id = erc.prod_id AND erc.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates epafd
ON p.prod_id = epafd.prod_id AND epafd.deleted = 0 AND epafd.type = 3
LEFT JOIN tz_prod_emergency_response_intervals eri ON erc.id = eri.config_id AND eri.deleted = 0
LEFT JOIN tz_prod_additional_fee_periods afp ON p.prod_id = afp.prod_id AND afp.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates afd
ON p.prod_id = afd.prod_id AND afd.deleted = 0 and afd.type = 1
LEFT JOIN tz_prod_reservation_config rc ON p.prod_id = rc.prod_id AND rc.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates rpafd
ON p.prod_id = rpafd.prod_id AND rpafd.deleted = 0 AND rpafd.type = 2
LEFT JOIN tz_product_order_limit ol ON p.prod_id = ol.prod_id AND ol.deleted = 0
LEFT JOIN tz_prod_extend tpe ON p.prod_id = tpe.prod_id
LEFT JOIN tz_prod_weight_range_prices wrp ON p.prod_id = wrp.prod_id AND wrp.deleted = 0
LEFT JOIN tz_prod_service_over_area_rules sa ON p.prod_id = sa.prod_id AND sa.deleted = 0
LEFT JOIN tz_prod_service_area_relevance sar ON p.prod_id = sar.prod_id
LEFT JOIN tz_prod_service_areas saa ON sar.area_id = saa.id AND saa.deleted = 0
where p.deleted = 0
AND p.prod_id = #{prodId}
ORDER BY p.prod_id ,rpafd.date_type ,epafd.date_type,afd.date_type ASC
</select>
@@ -416,8 +403,7 @@
p.order_limit_switch,
p.weight_switch,
p.region_switch,
<!-- 只有当 emergencySwitch 开启时,才查询紧急响应相关字段 -->
<if test="emergencySwitch != null and emergencySwitch == 1">
erc.id AS erc_record_id,
erc.response_time_slots as erc_response_time_slots,
@@ -429,7 +415,7 @@
eri.id AS eri_record_id,
eri.config_id AS eri_config_id,
eri.mode_name,
eri.name as eri_name,
eri.response_hours,
eri.charge_mode,
eri.floating_percentage,
@@ -439,9 +425,8 @@
eri.creator AS eri_creator,
eri.updater AS eri_updater,
eri.deleted AS eri_deleted,
</if>
<!-- 只有当 additionalFeeSwitch 开启时,才查询特殊日期规则相关字段 -->
<if test="additionalFeeSwitch != null and additionalFeeSwitch == 1">
afp.id AS afp_record_id,
afp.prod_id AS afp_prod_id,
afp.name AS afp_name,
@@ -449,9 +434,8 @@
afp.charge_mode AS afp_charge_mode,
afp.price AS afp_price,
afp.floating_percentage AS afp_floating_percentage,
</if>
<!-- 只有当 additionalSwitch 开启时,才查询特殊时段规则相关字段 -->
<if test="additionalSwitch != null and additionalSwitch == 1">
afd.id AS afd_record_id,
afd.prod_id AS afd_prod_id,
afd.name AS afd_name,
@@ -466,9 +450,8 @@
afd.creator AS afd_creator,
afd.updater AS afd_updater,
afd.deleted AS afd_deleted,
</if>
<!-- 只有当 reservationSwitch 开启时,才查询预约配置相关字段 -->
<if test="reservationSwitch != null and reservationSwitch == 1">
rc.id AS rc_record_id,
rc.prod_id AS rc_prod_id,
rc.reservation_time_slots AS rc_reservation_time_slots,
@@ -484,49 +467,48 @@
rpafd.custom_time_slots as black_custom_time_slots,
rpafd.type as black_type,
rpafd.is_enabled as black_is_enabled,
</if>
<!-- 只有当 orderLimitSwitch 开启时,才查询接单上限配置相关字段 -->
<if test="orderLimitSwitch != null and orderLimitSwitch == 1">
ol.id AS ol_record_id,
ol.prod_id AS ol_prod_id,
ol.limit_unit AS ol_limit_unit,
ol.max_orders AS ol_max_orders,
</if>
<!-- 只有当 weightSwitch 开启时,才查询体重区间价格相关字段 -->
<if test="weightSwitch != null and weightSwitch == 1">
tpe.is_weight_charge as tpe_is_weight_charge,
wrp.id AS wrp_record_id,
wrp.prod_id AS wrp_prod_id,
wrp.weight_range AS wrp_weight_range,
wrp.price AS wrp_price,
wrp.is_enabled AS wrp_is_enabled,
</if>
p.prod_name
FROM
tz_prod p
<!-- 只有当 emergencySwitch 开启时才进行 LEFT JOIN -->
<if test="emergencySwitch != null and emergencySwitch == 1">
LEFT JOIN tz_prod_emergency_response erc ON p.prod_id = erc.prod_id AND erc.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates epafd ON p.prod_id = epafd.prod_id AND epafd.deleted = 0 AND epafd.type = 3
LEFT JOIN tz_prod_emergency_response_intervals eri ON erc.id = eri.config_id AND eri.deleted = 0
</if>
<if test="additionalFeeSwitch != null and additionalFeeSwitch == 1">
LEFT JOIN tz_prod_additional_fee_periods afp ON p.prod_id = afp.prod_id AND afp.deleted = 0
</if>
<if test="additionalSwitch != null and additionalSwitch == 1">
LEFT JOIN tz_prod_additional_fee_dates afd ON p.prod_id = afd.prod_id AND afd.deleted = 0 afd.type = 1
</if>
<if test="reservationSwitch != null and reservationSwitch == 1">
LEFT JOIN tz_prod_additional_fee_dates afd ON p.prod_id = afd.prod_id AND afd.deleted = 0 and afd.type = 1
LEFT JOIN tz_prod_reservation_config rc ON p.prod_id = rc.prod_id AND rc.deleted = 0
LEFT JOIN tz_prod_additional_fee_dates rpafd ON p.prod_id = rpafd.prod_id AND rpafd.deleted = 0 AND rpafd.type = 2
</if>
<if test="orderLimitSwitch != null and orderLimitSwitch == 1">
LEFT JOIN tz_product_order_limit ol ON p.prod_id = ol.prod_id AND ol.deleted = 0
</if>
<if test="weightSwitch != null and weightSwitch == 1">
LEFT JOIN tz_prod_extend tpe ON p.prod_id = tpe.prod_id
LEFT JOIN tz_prod_weight_range_prices wrp ON p.prod_id = wrp.prod_id AND wrp.deleted = 0
</if>
where p.deleted = 0
AND p.prod_id = #{prodId}
ORDER BY p.prod_id