|
@@ -176,18 +176,21 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
|
business.add(param.getMainBusiness());
|
|
|
}
|
|
|
// this.categoryService.removeByIds(business);
|
|
|
- List<Category> categories = this.categoryService.getCategories(business);
|
|
|
- if (!CollectionUtils.isEmpty(categories)){
|
|
|
- categories.forEach(item ->{
|
|
|
- item.setSourceId(item.getId());
|
|
|
- item.setId(null);
|
|
|
- item.setMerchantId(merchant.getId());
|
|
|
- item.setType("1");
|
|
|
- item.setParentId(0L);
|
|
|
- this.categoryService.save(item);
|
|
|
- });
|
|
|
- // this.categoryService.saveBatchCategories(categories);
|
|
|
+ if (!CollectionUtils.isEmpty(business)){
|
|
|
+ List<Category> categories = this.categoryService.getCategories(business);
|
|
|
+ if (!CollectionUtils.isEmpty(categories)){
|
|
|
+ categories.forEach(item ->{
|
|
|
+ item.setSourceId(item.getId());
|
|
|
+ item.setId(null);
|
|
|
+ item.setMerchantId(merchant.getId());
|
|
|
+ item.setType("1");
|
|
|
+ item.setParentId(0L);
|
|
|
+ this.categoryService.save(item);
|
|
|
+ });
|
|
|
+ // this.categoryService.saveBatchCategories(categories);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return merchant.getId();
|
|
|
}
|
|
|
|
|
@@ -201,20 +204,21 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
|
business.add(param.getMainBusiness());
|
|
|
}
|
|
|
// this.categoryService.removeByIds(business);
|
|
|
- this.categoryService.deleteByMerchantId(merchant.getId());
|
|
|
- List<Category> categories = this.categoryService.getCategories(business);
|
|
|
- if (!CollectionUtils.isEmpty(categories)){
|
|
|
- categories.forEach(item ->{
|
|
|
- item.setSourceId(item.getId());
|
|
|
- item.setId(null);
|
|
|
- item.setMerchantId(merchant.getId());
|
|
|
- item.setType("1");
|
|
|
- item.setParentId(0L);
|
|
|
+ if (!CollectionUtils.isEmpty(business)){
|
|
|
+ this.categoryService.deleteByMerchantId(merchant.getId());
|
|
|
+ List<Category> categories = this.categoryService.getCategories(business);
|
|
|
+ if (!CollectionUtils.isEmpty(categories)){
|
|
|
+ categories.forEach(item ->{
|
|
|
+ item.setSourceId(item.getId());
|
|
|
+ item.setId(null);
|
|
|
+ item.setMerchantId(merchant.getId());
|
|
|
+ item.setType("1");
|
|
|
+ item.setParentId(0L);
|
|
|
// this.categoryService.save(item);
|
|
|
- });
|
|
|
- this.categoryService.saveBatchCategories(categories);
|
|
|
+ });
|
|
|
+ this.categoryService.saveBatchCategories(categories);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|