获取服务配置

This commit is contained in:
xuelijun
2025-08-15 18:27:57 +08:00
parent 7afa85b941
commit ce643990d8
26 changed files with 462 additions and 196 deletions

View File

@@ -50,6 +50,7 @@
<result property="reservationDateRange" column="rc_reservation_date_range"/>
<result property="allowChange" column="rc_allow_change"/>
<result property="changeTimeRule" column="rc_change_time_rule"/>
<result property="timeSlot" column="rc_time_slot"/>
<result property="maxChangeTimes" column="rc_max_change_times"/>
<result property="blacklistedDates" column="rc_blacklisted_dates"/>
<result property="isBlacklisted" column="rc_is_blacklisted"/>
@@ -173,6 +174,7 @@
<result property="reservationDateRange" column="rc_reservation_date_range"/>
<result property="allowChange" column="rc_allow_change"/>
<result property="changeTimeRule" column="rc_change_time_rule"/>
<result property="timeSlot" column="rc_time_slot"/>
<result property="maxChangeTimes" column="rc_max_change_times"/>
<result property="blacklistedDates" column="rc_blacklisted_dates"/>
<result property="isBlacklisted" column="rc_is_blacklisted"/>
@@ -233,26 +235,7 @@
<select id="getProdPageList" resultType="com.tashow.cloud.productapi.api.product.dto.ProdDO">
SELECT * FROM tz_prod
where deleted = 0
<if test="createTime != null and createTime.length == 2">
AND create_time BETWEEN #{createTime[0]} AND #{createTime[1]}
</if>
<if test="prodName != null">
AND prod_name = #{prodName}
</if>
<if test="shopId != null">
AND shop_id = #{shopId}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="categoryId != null">
AND category_id = #{categoryId}
</if>
ORDER by create_time DESC
</select>
<!-- 动态SQL查询商品列表及其服务配置 (返回 List<ProdServiceVO>) -->
@@ -265,6 +248,12 @@
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,
@@ -328,6 +317,7 @@
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,
rc.blacklisted_dates AS rc_blacklisted_dates,
rc.is_blacklisted AS rc_is_blacklisted,
@@ -405,6 +395,7 @@
p.reservation_switch,
p.order_limit_switch,
p.weight_switch,
p.region_switch,
<!-- 只有当 emergencySwitch 开启时,才查询紧急响应相关字段 -->
<if test="emergencySwitch != null and emergencySwitch == 1">
erc.id AS erc_record_id,
@@ -468,6 +459,7 @@
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,
rc.blacklisted_dates AS rc_blacklisted_dates,
rc.is_blacklisted AS rc_is_blacklisted,
@@ -523,48 +515,64 @@
<!-- 结果映射:将数据库查询结果映射到 ProdServiceVO -->
<resultMap id="ProdRecycleBinMap" type="com.tashow.cloud.productapi.api.product.vo.prod.ProdListVO"> <!-- 确保这是 ProdServiceVO 的正确包名 -->
<resultMap id="ProdRecycleBinMap" type="com.tashow.cloud.productapi.api.product.vo.prod.ProdRestoreListVO"> <!-- 确保这是 ProdServiceVO 的正确包名 -->
<!-- 商品基本信息映射 -->
<id property="prodId" column="prod_id"/>
<result property="prodName" column="prod_name"/>
<result property="categoryName" column="category_name"/>
<result property="shopId" column="shop_id"/>
<result property="shopName" column="shop_name"/>
<result property="responseHours" column="response_hours"/>
<result property="reservationTimeSlots" column="reservation_time_slots"/>
<result property="deleteTime" column="delete_time"/>
<result property="createTime" column="create_time"/>
<collection property="areaNameList" ofType="string">
<result column="sa_area_name"/>
<result column="area_name"/>
</collection>
<!-- <association property="prodReservationConfig" javaType="com.tashow.cloud.productapi.api.product.dto.ProdReservationConfigDO">
<id property="id" column="rc_record_id"/>
<result property="prodId" column="rc_prod_id"/>
<result property="reservationTimeSlots" column="rc_reservation_time_slots"/>
<result property="advanceHours" column="rc_advance_hours"/>
<result property="reservationDateRange" column="rc_reservation_date_range"/>
<result property="allowChange" column="rc_allow_change"/>
<result property="changeTimeRule" column="rc_change_time_rule"/>
<result property="maxChangeTimes" column="rc_max_change_times"/>
<result property="blacklistedDates" column="rc_blacklisted_dates"/>
<result property="isBlacklisted" column="rc_is_blacklisted"/>
<result property="blackAppointDates" column="rc_black_appoint_dates"/>
<result property="isBlackAppoint" column="rc_is_black_appoint"/>
<result property="blackHappy" column="rc_black_happy"/>
<result property="blackWeekend" column="rc_black_weekend"/>
</association>-->
</resultMap>
<resultMap id="ProdListMap" type="com.tashow.cloud.productapi.api.product.vo.prod.ProdListVO"> <!-- 确保这是 ProdServiceVO 的正确包名 -->
<!-- 商品基本信息映射 -->
<id property="prodId" column="prod_id"/>
<result property="prodName" column="prod_name"/>
<result property="categoryName" column="category_name"/>
<result property="shopId" column="shop_id"/>
<result property="shopName" column="shop_name"/>
<result property="status" column="status"/>
<result property="shopName" column="shop_name"/>
<result property="isProhibit" column="is_prohibit"/>
<result property="responseHours" column="response_hours"/>
<result property="processNotes" column="processNotes"/>
<result property="reservationTimeSlots" column="reservation_time_slots"/>
<result property="deleteTime" column="delete_time"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<collection property="areaNameList" ofType="string">
<result column="area_name"/>
</collection>
</resultMap>
<select id="getProdRecycleBinPageList" resultMap="ProdRecycleBinMap" >
select tp.prod_id,tp.prod_name,tp.category_name,tp.shop_id,tsd.shop_name,tpsa.area_name
select tp.prod_id,tp.prod_name,tp.category_name,tp.shop_id,tsd.shop_name,tpsa.area_name,min_eri.response_hours,
tprc.reservation_time_slots,tp.delete_time,tp.create_time
from tz_prod tp
left join tz_shop_detail tsd on tp.shop_id = tsd.shop_id
left join tz_prod_service_area_relevance tpsar on tp.prod_id = tpsar.prod_id
left join tz_prod_service_areas tpsa on tpsar.area_id = tpsa.id
where deleted = 1
<if test="properties != null and properties != ''">
and tp.properties like concat('%', #{prodName}, '%')
left join tz_prod_reservation_config tprc on tp.prod_id = tprc.prod_id
LEFT JOIN (
SELECT
prod_id,
MIN(response_hours) AS response_hours
FROM tz_prod_emergency_response_intervals
WHERE deleted = 0 -- 排除已删除的配置
GROUP BY prod_id
) min_eri ON tp.prod_id = min_eri.prod_id
where tp.deleted = 1
<if test="prodName != null and prodName != ''">
and tp.prod_ame like concat('%', #{prodName}, '%')
</if>
<if test="deleteTime != null and deleteTime.length == 2">
AND tp.delete_time BETWEEN #{deleteTime[0]} AND #{deleteTime[1]}
@@ -572,6 +580,42 @@
</select>
<select id="getProdPageList" resultMap="ProdListMap" >
select tp.prod_id,tp.prod_name,tp.category_name,tp.shop_id,tsd.shop_name,tpsa.area_name,min_eri.response_hours,
tprc.reservation_time_slots,tp.delete_time,tp.create_time,tp.update_time,tp.status,tp.is_prohibit,
tp.process_notes processNotes
from tz_prod tp
left join tz_shop_detail tsd on tp.shop_id = tsd.shop_id
left join tz_prod_service_area_relevance tpsar on tp.prod_id = tpsar.prod_id
left join tz_prod_service_areas tpsa on tpsar.area_id = tpsa.id
left join tz_prod_reservation_config tprc on tp.prod_id = tprc.prod_id
LEFT JOIN (
SELECT
prod_id,
MIN(response_hours) AS response_hours
FROM tz_prod_emergency_response_intervals
WHERE deleted = 0 -- 排除已删除的配置
GROUP BY prod_id
) min_eri ON tp.prod_id = min_eri.prod_id
where tp.deleted = 0
<if test="createTime != null and createTime.length == 2">
AND tp.create_time BETWEEN #{createTime[0]} AND #{createTime[1]}
</if>
<if test="prodName != null">
AND tp.prod_name = #{prodName}
</if>
<if test="shopId != null">
AND tp.shop_id = #{shopId}
</if>
<if test="status != null">
AND tp.status = #{status}
</if>
<if test="categoryId != null">
AND tp.category_id = #{categoryId}
</if>
ORDER by tp.create_time DESC
</select>
<update id="batchRestoreProd">
UPDATE tz_prod
SET deleted = 0