|  | @@ -20,8 +20,10 @@ import com.yami.shop.dao.ShopCategoryMapper;
 | 
											
												
													
														|  |  import com.yami.shop.dao.ShopDetailMapper;
 |  |  import com.yami.shop.dao.ShopDetailMapper;
 | 
											
												
													
														|  |  import com.yami.shop.service.IShopCategoryService;
 |  |  import com.yami.shop.service.IShopCategoryService;
 | 
											
												
													
														|  |  import lombok.AllArgsConstructor;
 |  |  import lombok.AllArgsConstructor;
 | 
											
												
													
														|  | 
 |  | +import lombok.extern.slf4j.Slf4j;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.ObjectUtils;
 |  |  import org.apache.commons.lang3.ObjectUtils;
 | 
											
												
													
														|  |  import org.springframework.beans.BeanUtils;
 |  |  import org.springframework.beans.BeanUtils;
 | 
											
												
													
														|  | 
 |  | +import org.springframework.core.annotation.OrderUtils;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  import org.springframework.web.multipart.MultipartFile;
 |  |  import org.springframework.web.multipart.MultipartFile;
 | 
											
										
											
												
													
														|  | @@ -38,6 +40,7 @@ import java.util.stream.Collectors;
 | 
											
												
													
														|  |   * @author YourName
 |  |   * @author YourName
 | 
											
												
													
														|  |   * @since 2025-09-XX
 |  |   * @since 2025-09-XX
 | 
											
												
													
														|  |   */
 |  |   */
 | 
											
												
													
														|  | 
 |  | +@Slf4j
 | 
											
												
													
														|  |  @Service
 |  |  @Service
 | 
											
												
													
														|  |  @AllArgsConstructor
 |  |  @AllArgsConstructor
 | 
											
												
													
														|  |  public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, ShopCategory> implements IShopCategoryService {
 |  |  public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, ShopCategory> implements IShopCategoryService {
 | 
											
										
											
												
													
														|  | @@ -122,9 +125,21 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
 | 
											
												
													
														|  |                      ShopCategory category = shopCategories.get(i);
 |  |                      ShopCategory category = shopCategories.get(i);
 | 
											
												
													
														|  |                      // 检查数据有效性
 |  |                      // 检查数据有效性
 | 
											
												
													
														|  |                      Long shopId = validateShopCategories(category, i);
 |  |                      Long shopId = validateShopCategories(category, i);
 | 
											
												
													
														|  | -                    category.setShopId(shopId);
 |  | 
 | 
											
												
													
														|  | -                    category.setPid(0L);
 |  | 
 | 
											
												
													
														|  | -                    this.save(category);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    ShopCategory shopCategory = shopCategoryMapper.selectOne(
 | 
											
												
													
														|  | 
 |  | +                            new LambdaQueryWrapper<ShopCategory>()
 | 
											
												
													
														|  | 
 |  | +                                    .eq(ShopCategory::getName, category.getName())
 | 
											
												
													
														|  | 
 |  | +                                    .eq(ShopCategory::getShopId, shopId)
 | 
											
												
													
														|  | 
 |  | +                    .eq(ShopCategory::getIsDelete, 0).eq(ShopCategory::getPid, 0L));
 | 
											
												
													
														|  | 
 |  | +                    if (ObjectUtils.isEmpty(shopCategory)) {
 | 
											
												
													
														|  | 
 |  | +                        category.setShopId(shopId);
 | 
											
												
													
														|  | 
 |  | +                        category.setPid(0L);
 | 
											
												
													
														|  | 
 |  | +                        this.save(category);
 | 
											
												
													
														|  | 
 |  | +                    } else {
 | 
											
												
													
														|  | 
 |  | +                        category.setId(shopCategory.getId());
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +                    System.out.println(category);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |                      //添加对应的二级和三级类目
 |  |                      //添加对应的二级和三级类目
 | 
											
												
													
														|  |                      FrontCategory frontCategoryByName = frontCategoryMapper.selectListName(category.getSubName());
 |  |                      FrontCategory frontCategoryByName = frontCategoryMapper.selectListName(category.getSubName());
 | 
											
												
													
														|  |                      frontCategoryByName.setParentCode(category.getCode());
 |  |                      frontCategoryByName.setParentCode(category.getCode());
 | 
											
										
											
												
													
														|  | @@ -187,7 +202,7 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          shopCategory.setHbShopId(hbShopId);
 |  |          shopCategory.setHbShopId(hbShopId);
 | 
											
												
													
														|  |          shopCategory.setShopId(shopId);
 |  |          shopCategory.setShopId(shopId);
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +log.info("添加门店前台类目:{}", shopCategory);
 | 
											
												
													
														|  |          this.save(shopCategory);
 |  |          this.save(shopCategory);
 | 
											
												
													
														|  |          List<FrontCategory> frontCategoryList = frontCategoryMapper.selectList(new LambdaQueryWrapper<FrontCategory>()
 |  |          List<FrontCategory> frontCategoryList = frontCategoryMapper.selectList(new LambdaQueryWrapper<FrontCategory>()
 | 
											
												
													
														|  |                  .eq(FrontCategory::getParentCode, frontCategory.getCode()));
 |  |                  .eq(FrontCategory::getParentCode, frontCategory.getCode()));
 |