This commit is contained in:
张松 2025-10-31 16:07:48 +08:00
parent ffbc0d0a30
commit 2180aa9c6d
1 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import com.czg.account.dto.ShopConfigDTO;
import com.czg.account.entity.ShopConfig;
import com.czg.account.service.ShopConfigService;
import com.czg.sa.StpKit;
import com.czg.service.RedisService;
import com.czg.service.account.mapper.ShopConfigMapper;
import com.czg.service.account.mapper.ShopInfoMapper;
import com.czg.utils.PageUtil;
@ -12,6 +13,9 @@ import com.mybatisflex.core.util.LambdaGetter;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.List;
@ -27,6 +31,8 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
@Resource
private ShopInfoMapper shopInfoMapper;
@Resource
private RedisService redisService;
private QueryWrapper buildQueryWrapper(ShopConfigDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
@ -48,9 +54,9 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
shopConfig.setId(mainShopId);
save(shopConfig);
}
List<Long> extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList();
if (!shopIdList.isEmpty()) {
List<Long> extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList();
shopIdList.stream().filter(id -> !extistList.contains(id)).forEach(id -> {
save(new ShopConfig().setId(id).setMainId(mainShopId));
});
@ -81,6 +87,9 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
}
}
extistList.forEach(item -> redisService.del("shopInfo::" + item));
redisService.del("shopInfo::" + mainShopId);
}
}