|
@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
|
|
+import com.cyksj.mapper.shop.YhShopMapper;
|
|
|
|
|
+import com.cyksj.model.entity.YhShop;
|
|
|
import com.cyksj.model.entity.YhShopGoodsSku;
|
|
import com.cyksj.model.entity.YhShopGoodsSku;
|
|
|
import com.cyksj.model.views.YhShopAvailableGoodsView;
|
|
import com.cyksj.model.views.YhShopAvailableGoodsView;
|
|
|
import com.cyksj.model.views.YhShopGoodsRateView;
|
|
import com.cyksj.model.views.YhShopGoodsRateView;
|
|
|
import com.cyksj.model.views.YhShopGoodsView;
|
|
import com.cyksj.model.views.YhShopGoodsView;
|
|
|
|
|
+import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.shop.YhShopGoodsSkuService;
|
|
import com.cyksj.service.shop.YhShopGoodsSkuService;
|
|
|
import com.cyksj.web.util.StpYhShopManageUser;
|
|
import com.cyksj.web.util.StpYhShopManageUser;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
@@ -33,6 +36,11 @@ public class YhShopGoodsController {
|
|
|
private final BeanSearcher beanSearcher;
|
|
private final BeanSearcher beanSearcher;
|
|
|
|
|
|
|
|
private final YhShopGoodsSkuService yhShopGoodsSkuService;
|
|
private final YhShopGoodsSkuService yhShopGoodsSkuService;
|
|
|
|
|
+
|
|
|
|
|
+ private final RedisService redisService;
|
|
|
|
|
+
|
|
|
|
|
+ private final YhShopMapper yhShopMapper;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增平台
|
|
* 新增平台
|
|
|
*/
|
|
*/
|
|
@@ -64,7 +72,11 @@ public class YhShopGoodsController {
|
|
|
@PutMapping("/put/goodsStatus/{goodsId}")
|
|
@PutMapping("/put/goodsStatus/{goodsId}")
|
|
|
public Result<Void> updGoodsStatus(@PathVariable Long goodsId, Boolean status){
|
|
public Result<Void> updGoodsStatus(@PathVariable Long goodsId, Boolean status){
|
|
|
long userId = StpYhShopManageUser.getLoginIdAsLong();
|
|
long userId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
|
|
+ YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
|
|
|
|
|
+ .eq(YhShop::getUserId, userId).last("limit 1"));
|
|
|
yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getDeleted, true).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getStatus, status));
|
|
yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getDeleted, true).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getStatus, status));
|
|
|
|
|
+ String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
|
|
|
|
|
+ redisService.del(yhShopCacheKey);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -75,7 +87,11 @@ public class YhShopGoodsController {
|
|
|
@PutMapping("/del/{goodsId}")
|
|
@PutMapping("/del/{goodsId}")
|
|
|
public Result<Void> updGoodsStatus(@PathVariable Long goodsId){
|
|
public Result<Void> updGoodsStatus(@PathVariable Long goodsId){
|
|
|
long userId = StpYhShopManageUser.getLoginIdAsLong();
|
|
long userId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
|
|
+ YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
|
|
|
|
|
+ .eq(YhShop::getUserId, userId).last("limit 1"));
|
|
|
yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getDeleted, false));
|
|
yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getDeleted, false));
|
|
|
|
|
+ String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
|
|
|
|
|
+ redisService.del(yhShopCacheKey);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|