|
@@ -1,7 +1,7 @@
|
|
|
package shop.alien.store.service.impl;
|
|
|
+
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -29,41 +29,19 @@ public class TagStoreRelationServiceImpl implements TagStoreRelationService {
|
|
|
// 将数据存储到数据库中
|
|
|
tagStoreRelationMapper.insert(tagStoreRelation);
|
|
|
}
|
|
|
- String cacheKey = buildTagStoreCacheKey(tagStoreRelation.getStoreId());
|
|
|
-// try {
|
|
|
-// baseRedisService.storeObject(cacheKey, tagStoreRelation);
|
|
|
-// } catch (JsonProcessingException e) {
|
|
|
-// throw new RuntimeException(e);
|
|
|
-// }
|
|
|
return tagStoreRelation;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public TagStoreRelation getTagStoreRelationByStoreId(int storeId) {
|
|
|
-// TagStoreRelation tagStoreRelation = null;
|
|
|
-// String cacheKey = buildTagStoreCacheKey(storeId);
|
|
|
-// try {
|
|
|
-// tagStoreRelation = baseRedisService.getObject(cacheKey, TagStoreRelation.class);
|
|
|
-// } catch (JsonProcessingException e) {
|
|
|
-// log.error("Failed to deserialize TagStoreRelation from Redis", e);
|
|
|
-// throw new RuntimeException(e);
|
|
|
-// }
|
|
|
-// if (tagStoreRelation != null) {
|
|
|
-// return tagStoreRelation;
|
|
|
-// }
|
|
|
-// LambdaQueryWrapper<TagStoreRelation> wrapper = new LambdaQueryWrapper<>();
|
|
|
-// wrapper.eq(TagStoreRelation::getStoreId, storeId);
|
|
|
-// List<TagStoreRelation> tagStoreRelationList = tagStoreRelationMapper.selectList(wrapper);
|
|
|
-// if (CollectionUtils.isNotEmpty(tagStoreRelationList)) {
|
|
|
-// tagStoreRelation = tagStoreRelationList.get(0);
|
|
|
-// try {
|
|
|
-// baseRedisService.storeObject(cacheKey, tagStoreRelation);
|
|
|
-// } catch (JsonProcessingException e) {
|
|
|
-// log.error("Failed to serialize TagStoreRelation to Redis", e);
|
|
|
-// throw new RuntimeException(e);
|
|
|
-// }
|
|
|
-// }
|
|
|
- return null;
|
|
|
+ TagStoreRelation tagStoreRelation = new TagStoreRelation();
|
|
|
+ LambdaQueryWrapper<TagStoreRelation> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(TagStoreRelation::getStoreId, storeId);
|
|
|
+ List<TagStoreRelation> tagStoreRelationList = tagStoreRelationMapper.selectList(wrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(tagStoreRelationList)) {
|
|
|
+ tagStoreRelation = tagStoreRelationList.get(0);
|
|
|
+ }
|
|
|
+ return tagStoreRelation;
|
|
|
}
|
|
|
|
|
|
/**
|