规格回收站
This commit is contained in:
@@ -54,8 +54,8 @@ public class ProdController {
|
||||
@PostMapping("/uptateProdService")
|
||||
@Operation(summary = "修改商品服务配置")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> uptateProdService(@Valid @RequestBody ProdServiceVO prodServiceVO) {
|
||||
prodService.uptateProdService(prodServiceVO);
|
||||
public CommonResult<Boolean> uptateProdService(@Valid @RequestBody ProdServiceInfoVO prodServiceInfoVO) {
|
||||
prodService.uptateProdService(prodServiceInfoVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ProdController {
|
||||
ProdDO prod = new ProdDO();
|
||||
prod.setProdId(id);
|
||||
prod.setStatus(status);
|
||||
prodMapper.updateBatch(prod);
|
||||
prodMapper.updateById(prod);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.tashow.cloud.product.service.ProdExtendService;
|
||||
import com.tashow.cloud.product.service.ProdPropService;
|
||||
import com.tashow.cloud.product.service.ProdPropValueService;
|
||||
import com.tashow.cloud.product.service.SkuService;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPageReqVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPropRecycleBinVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.sku.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -76,6 +78,18 @@ public class SkuController {
|
||||
return success(skuService.getSKuPropList(prodId));
|
||||
}
|
||||
|
||||
|
||||
@PermitAll
|
||||
@GetMapping("/getPropRecycleBinList")
|
||||
@Operation(summary = "获取规格回收站")
|
||||
public CommonResult<PageResult<ProPropRecycleBinVO>> getSKuPropRecycleBinList(ProPageReqVO proPageReqVO) {
|
||||
PageResult<ProPropRecycleBinVO> pageResult = skuService.getSKuPropRecycleBinList(proPageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PutMapping("/deleteProp")
|
||||
@Operation(summary = "删除规格值")
|
||||
@PermitAll
|
||||
|
||||
@@ -2,10 +2,14 @@ package com.tashow.cloud.product.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||
import com.tashow.cloud.productapi.api.product.dto.ProdPropValueDO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPropRecycleBinVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.sku.SkuRecycleBinVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -34,4 +38,6 @@ public interface ProdPropValueMapper extends BaseMapperX<ProdPropValueDO> {
|
||||
|
||||
List<ProdPropValueDO> selectRestoreProp(@Param("prodId") Long prodId);
|
||||
|
||||
IPage<ProPropRecycleBinVO> getSKuPropRecycleBinList(Page<?> page, @Param("prodId") Long prodId,@Param("propValue")String propValue);
|
||||
|
||||
}
|
||||
@@ -31,4 +31,9 @@ public interface SkuMapper extends BaseMapperX<SkuDO> {
|
||||
int deleteBySkuId( @Param("skuId")Long skuId);
|
||||
|
||||
void batchSkuDeleted(@Param("ids") List<Long> ids);
|
||||
|
||||
void updateSkuDeleted(@Param("skuId") Long skuId);
|
||||
|
||||
|
||||
List<SkuDO> getskuListBySkuIds( @Param("ids")List<Long> ids);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public interface ProdService {
|
||||
* @param prodServiceVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
void uptateProdService(@Valid ProdServiceVO prodServiceVO);
|
||||
void uptateProdService(@Valid ProdServiceInfoVO prodServiceInfoVO);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.tashow.cloud.product.service;
|
||||
import java.util.*;
|
||||
|
||||
import com.tashow.cloud.productapi.api.product.dto.*;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPageReqVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPropRecycleBinVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.sku.*;
|
||||
import jakarta.validation.*;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
@@ -74,6 +76,7 @@ public interface SkuService {
|
||||
|
||||
SkuPropInfoVO getSKuPropList(Long prodId);
|
||||
|
||||
PageResult<ProPropRecycleBinVO> getSKuPropRecycleBinList(ProPageReqVO proPageReqVO);
|
||||
/**
|
||||
* 删除单品SKU
|
||||
*
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.tashow.cloud.product.service.ProdService;
|
||||
|
||||
import com.tashow.cloud.productapi.api.product.vo.prod.*;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodadditionalfeedates.ProdAdditionalFeeBlackVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodreservationconfig.ProdReservationInfoReqVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodreservationconfig.ProdReservationInfoVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.sku.SkuPageReqVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.sku.SkuRecycleBinVO;
|
||||
@@ -178,7 +179,7 @@ public class ProdServiceImpl implements ProdService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void uptateProdService(ProdServiceVO prodServiceVO) {
|
||||
public void uptateProdService(ProdServiceInfoVO prodServiceVO) {
|
||||
|
||||
ProdDO prod = BeanUtils.toBean(prodServiceVO, ProdDO.class);
|
||||
//服务区域设置
|
||||
@@ -237,7 +238,7 @@ public class ProdServiceImpl implements ProdService {
|
||||
.eq(ProdReservationConfigDO::getProdId, prodServiceVO.getProdId()));
|
||||
if (reservationConfig == null) {
|
||||
prod.setReservationSwitch(BaseEnum.YES_ONE.getKey());
|
||||
ProdReservationInfoVO prodReservationInfoVO = prodServiceVO.getProdReservationConfig();
|
||||
ProdReservationInfoReqVO prodReservationInfoVO = prodServiceVO.getProdReservationConfig();
|
||||
ProdReservationConfigDO prodReservationConfigDO = BeanUtils.toBean(prodReservationInfoVO, ProdReservationConfigDO.class);
|
||||
prodReservationConfigDO.setProdId(prod.getProdId());
|
||||
prodReservationConfigDO.setTimeBook(prodServiceVO.getProdReservationConfig().getTimeBook());
|
||||
@@ -311,6 +312,7 @@ public class ProdServiceImpl implements ProdService {
|
||||
for (ProdAdditionalFeeBlackVO prodAdditionalFeeBlackVO : prodServiceVO.getProdReservationConfig().getProdReservationBlackList()) {
|
||||
ProdAdditionalFeeDatesDO prodAdditionalFeeDatesDO = BeanUtils.toBean(prodAdditionalFeeBlackVO, ProdAdditionalFeeDatesDO.class);
|
||||
prodAdditionalFeeDatesDO.setProdId(prod.getProdId());
|
||||
prodAdditionalFeeDatesDO.setType(3);
|
||||
prodAdditionalFeeDatesMapper.insert(prodAdditionalFeeDatesDO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.tashow.cloud.product.service.ProdExtendService;
|
||||
import com.tashow.cloud.product.service.ProdPropService;
|
||||
import com.tashow.cloud.product.service.ProdPropValueService;
|
||||
import com.tashow.cloud.product.service.SkuService;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPageReqVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPropRecycleBinVO;
|
||||
import com.tashow.cloud.productapi.api.product.vo.sku.*;
|
||||
import com.tashow.cloud.productapi.enums.BaseEnum;
|
||||
import com.tashow.cloud.productapi.enums.ErrorCodeConstants;
|
||||
@@ -483,6 +485,17 @@ public class SkuServiceImpl implements SkuService {
|
||||
return skuPropInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProPropRecycleBinVO> getSKuPropRecycleBinList(ProPageReqVO proPageReqVO) {
|
||||
IPage<ProPropRecycleBinVO> prodPageList = prodPropValueMapper.getSKuPropRecycleBinList(MyBatisUtils.buildPage(proPageReqVO),proPageReqVO.getProdId(), proPageReqVO.getPropValue());
|
||||
for (ProPropRecycleBinVO prodPage : prodPageList.getRecords()) {
|
||||
if (prodPage.getDeleteTime() != null) {
|
||||
prodPage.setRemainingDays(DateUtils.getRemainingDays(prodPage.getDeleteTime()));
|
||||
}
|
||||
}
|
||||
return new PageResult<>(prodPageList.getRecords(), prodPageList.getTotal());
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public SkuPropInfoVO getSKuPropList(Long prodId, Integer isExpire, Integer state) {
|
||||
if (prodId == null) {
|
||||
@@ -710,14 +723,13 @@ public class SkuServiceImpl implements SkuService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void restoreSkuList(List<Long> ids) {
|
||||
List<SkuDO> skuList = skuMapper.selectByIds(ids);
|
||||
List<SkuDO> skuList = skuMapper.getskuListBySkuIds(ids);
|
||||
if (skuList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> currentlyUsedValues = new HashSet<>();
|
||||
for (SkuDO sku : skuList) {
|
||||
sku.setDeleted(BaseEnum.NO_ZERO.getKey());
|
||||
skuMapper.updateById(sku);
|
||||
skuMapper.updateSkuDeleted(sku.getSkuId());
|
||||
if (sku.getProperties() != null && !sku.getProperties().trim().isEmpty()) {
|
||||
String[] values = sku.getProperties().split(",");
|
||||
for (String v : values) {
|
||||
|
||||
@@ -588,7 +588,7 @@
|
||||
) 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}, '%')
|
||||
and tp.prod_name like concat('%', #{prodName}, '%')
|
||||
</if>
|
||||
<if test="deleteTime != null and deleteTime.length == 2">
|
||||
AND tp.delete_time BETWEEN #{deleteTime[0]} AND #{deleteTime[1]}
|
||||
@@ -641,4 +641,7 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -11,4 +11,7 @@
|
||||
<select id="getProdPropByPropNameAndShopId" resultType="com.tashow.cloud.productapi.api.product.dto.ProdPropDO">
|
||||
select * from tz_prod_prop where prop_name = #{propName} and prod_id = #{prodId} and rule = #{rule}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -78,6 +78,19 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getSKuPropRecycleBinList" resultType="com.tashow.cloud.productapi.api.product.vo.prodpropvalue.ProPropRecycleBinVO" >
|
||||
SELECT
|
||||
ppv.id,
|
||||
ppv.prop_value,
|
||||
ppv.prop_id,
|
||||
ppv.delete_time
|
||||
FROM tz_prod_prop pp
|
||||
JOIN tz_prod_prop_value ppv ON pp.id = ppv.prop_id
|
||||
WHERE pp.prod_id = #{prodId}
|
||||
AND ppv.is_expire = 1
|
||||
<if test="propValue != null and propValue != ''">
|
||||
and prop_value like concat('%', #{propValue}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -10,7 +10,7 @@
|
||||
-->
|
||||
|
||||
<select id="getSkuRecycleBinPageList" resultType="com.tashow.cloud.productapi.api.product.vo.sku.SkuRecycleBinVO" >
|
||||
select sku_id, properties, delete_time from tz_sku where prod_id = #{prodId} and deleted = 1
|
||||
select sku_id, properties,sku_name, delete_time from tz_sku where prod_id = #{prodId} and deleted = 1
|
||||
<if test="properties != null and properties != ''">
|
||||
and properties like concat('%', #{properties}, '%')
|
||||
</if>
|
||||
@@ -73,4 +73,21 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getskuListBySkuIds" resultType="com.tashow.cloud.productapi.api.product.dto.SkuDO">
|
||||
SELECT *
|
||||
FROM tz_sku
|
||||
WHERE sku_id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateSkuDeleted">
|
||||
UPDATE tz_sku
|
||||
SET deleted = 0
|
||||
WHERE sku_id = #{skuId}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user