浏览代码

新增商家时,标签店铺关系表插入默认数据。

zc 2 月之前
父节点
当前提交
5a30ff3248
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

+ 15 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -89,6 +89,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
 
     private final BaseRedisService baseRedisService;
 
+    private final TagStoreRelationMapper tagStoreRelationMapper;
+
     private final NearMeService nearMeService;
 
     private final WebAuditMapper webAuditMapper;
@@ -644,6 +646,19 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                 storeImgMapper.insert(storeImg);
         }
 
+        //初始化标签数据
+        LambdaQueryWrapper<TagStoreRelation> tagStoreRelationLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        tagStoreRelationLambdaQueryWrapper.eq(TagStoreRelation::getStoreId, storeInfo.getId());
+        tagStoreRelationLambdaQueryWrapper.eq(TagStoreRelation::getDeleteFlag, 0);
+        int tagStoreCount = tagStoreRelationMapper.selectCount(tagStoreRelationLambdaQueryWrapper);
+        if(tagStoreCount == 0){
+            TagStoreRelation tagStoreRelation = new TagStoreRelation();
+            tagStoreRelation.setStoreId(storeInfo.getId());
+            tagStoreRelation.setDeleteFlag(0);
+            tagStoreRelationMapper.insert(tagStoreRelation);
+        }
+
+
         // 发送通知
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String commonDate = simpleDateFormat.format(new Date());