sku规则恢复和列表

This commit is contained in:
xuelijun
2025-08-14 14:13:29 +08:00
parent 257dc16c94
commit 7afa85b941
14 changed files with 539 additions and 184 deletions

View File

@@ -520,14 +520,65 @@
</select>
<select id="getProdRecycleBinPageList" resultType="com.tashow.cloud.productapi.api.product.vo.sku.SkuRecycleBinVO" >
select * from tz_prod where deleted = 1
<!-- 结果映射:将数据库查询结果映射到 ProdServiceVO -->
<resultMap id="ProdRecycleBinMap" 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"/>
<collection property="areaNameList" ofType="string">
<result column="sa_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>
<select id="getProdRecycleBinPageList" resultMap="ProdRecycleBinMap" >
select tp.prod_id,tp.prod_name,tp.category_name,tp.shop_id,tsd.shop_name,tpsa.area_name
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 properties like concat('%', #{prodName}, '%')
and tp.properties like concat('%', #{prodName}, '%')
</if>
<if test="deleteTime != null and deleteTime.length == 2">
AND delete_time BETWEEN #{deleteTime[0]} AND #{deleteTime[1]}
AND tp.delete_time BETWEEN #{deleteTime[0]} AND #{deleteTime[1]}
</if>
</select>
<update id="batchRestoreProd">
UPDATE tz_prod
SET deleted = 0
WHERE prod_id IN
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@@ -22,7 +22,7 @@
SELECT
pp.id AS propId,
pp.prop_name,
ppv.id AS valueId,
ppv.id AS id,
ppv.prop_value
FROM tz_prod_prop pp
JOIN tz_prod_prop_value ppv ON pp.id = ppv.prop_id
@@ -35,7 +35,7 @@
SELECT
pp.id AS propId,
pp.prop_name,
ppv.id AS valueId,
ppv.id AS id,
ppv.prop_value
FROM tz_prod_prop pp
JOIN tz_prod_prop_value ppv ON pp.id = ppv.prop_id
@@ -54,7 +54,30 @@
SET is_expire = 1, delete_time = NOW()
WHERE id IN
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{ids}
#{id}
</foreach>
</update>
<update id="deleteProdPropValueById">
UPDATE tz_prod_prop_value
SET
is_expire = 1, delete_time = NOW()
WHERE id = #{id}
</update>
<select id="selectRestoreProp" resultType="com.tashow.cloud.productapi.api.product.dto.ProdPropValueDO">
SELECT
ppv.id AS id,
ppv.prop_value
FROM tz_prod_prop pp
JOIN tz_prod_prop_value ppv ON pp.id = ppv.prop_id
WHERE pp.prod_id = #{prodId}
AND pp.rule = 1
AND ppv.is_expire = 1
</select>
</mapper>

View File

@@ -26,14 +26,14 @@
and sku_id = #{skuId}
</if>
<if test="properties != null and properties != ''">
and properties like concat('%', #{propertiesName}, '%')
and properties like concat('%', #{properties}, '%')
</if>
</select>
<select id="getSkuListByName" resultType="com.tashow.cloud.productapi.api.product.dto.SkuDO" >
select sku_id, properties, delete_time,deleted from tz_sku
<if test="properties != null and properties != ''">
select sku_id, properties, delete_time,deleted from tz_sku where deleted = 0
<if test="propertiesName != null and propertiesName != ''">
and properties like concat('%', #{propertiesName}, '%')
</if>
</select>
@@ -55,5 +55,22 @@
and is_shelf =0
</select>
<update id="deleteBySkuId">
UPDATE tz_sku
SET
deleted = 1,
delete_time = now()
WHERE sku_id = #{skuId}
</update>
<update id="batchSkuDeleted">
UPDATE tz_sku
SET deleted = 1,
delete_time = now()
WHERE sku_id IN
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>