From 9e72e8a3cb0c02653febfa1bfc27ebb82c12d6dd Mon Sep 17 00:00:00 2001 From: Jiang Peng <2622360564@qq.com> Date: Sun, 3 Mar 2024 16:53:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=81=E7=B1=BB=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/domain/AsCategoryAttribute.java | 6 + .../domain/AsCategoryAttributeGroup.java | 6 + .../muyu/product/domain/AsCategoryBrand.java | 6 + .../com/muyu/product/domain/CategoryInfo.java | 34 +++- .../domain/req/CategoryInfoSaveReq.java | 5 + .../resp/CategoryParentCommonElementResp.java | 32 ++++ .../controller/AttributeGroupController.java | 1 + .../controller/CategoryInfoController.java | 23 ++- .../product/service/CategoryInfoService.java | 29 ++++ .../impl/AttributeInfoServiceImpl.java | 42 ++--- .../service/impl/CategoryInfoServiceImpl.java | 152 ++++++++++++++++-- 11 files changed, 291 insertions(+), 45 deletions(-) create mode 100644 muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/CategoryParentCommonElementResp.java diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttribute.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttribute.java index eaf121d..75156a8 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttribute.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttribute.java @@ -44,5 +44,11 @@ public class AsCategoryAttribute extends BaseEntity { @ApiModelProperty(name = "属性id", value = "属性id", required = true) private Long attributeId; + public static AsCategoryAttribute categoryBuild(Long categoryInfoId,Long attributeId){ + return AsCategoryAttribute.builder() + .categoryId(categoryInfoId) + .attributeId(attributeId) + .build(); + } } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttributeGroup.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttributeGroup.java index 7e27dce..6cc0ebf 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttributeGroup.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryAttributeGroup.java @@ -44,5 +44,11 @@ public class AsCategoryAttributeGroup extends BaseEntity { @ApiModelProperty(name = "属性组", value = "属性组", required = true) private Long attributeGroupId; + public static AsCategoryAttributeGroup categoryAttributeGroup(Long categoryId,Long attributeGroupId){ + return AsCategoryAttributeGroup.builder() + .categoryId(categoryId) + .attributeGroupId(attributeGroupId) + .build(); + } } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryBrand.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryBrand.java index bc52a80..a22df64 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryBrand.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/AsCategoryBrand.java @@ -44,4 +44,10 @@ public class AsCategoryBrand extends BaseEntity { @ApiModelProperty(name = "品牌id", value = "品牌id", required = true) private Long brandId; + public static AsCategoryBrand categoryBrand(Long categoryId,Long brandId){ + return AsCategoryBrand.builder() + .categoryId(categoryId) + .brandId(brandId) + .build(); + } } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/CategoryInfo.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/CategoryInfo.java index c4450c6..6cfbab8 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/CategoryInfo.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/CategoryInfo.java @@ -3,6 +3,7 @@ package com.muyu.product.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.product.domain.model.CategoryInfoSaveModel; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -15,6 +16,9 @@ import com.muyu.product.domain.req.CategoryInfoSaveReq; import com.muyu.product.domain.req.CategoryInfoEditReq; import com.muyu.common.core.web.domain.TreeEntity; +import java.util.Date; +import java.util.function.Supplier; + /** * 品类信息对象 category_info * @@ -58,8 +62,8 @@ public class CategoryInfo extends TreeEntity { private String introduction; /** - * 查询构造器 - */ + * 查询构造器 + */ public static CategoryInfo queryBuild( CategoryInfoQueryReq categoryInfoQueryReq){ return CategoryInfo.builder() .name(categoryInfoQueryReq.getName()) @@ -70,24 +74,38 @@ public class CategoryInfo extends TreeEntity { } /** - * 添加构造器 - */ - public static CategoryInfo saveBuild(CategoryInfoSaveReq categoryInfoSaveReq){ + * 添加构造器 + */ + public static CategoryInfo saveBuild(CategoryInfoSaveReq categoryInfoSaveReq, Supplier supplier){ return CategoryInfo.builder() .name(categoryInfoSaveReq.getName()) .image(categoryInfoSaveReq.getImage()) .start(categoryInfoSaveReq.getStart()) .introduction(categoryInfoSaveReq.getIntroduction()) .parentId(categoryInfoSaveReq.getParentId()) + .createBy(supplier.get()) + .createTime(new Date()) + .build(); + } + + public static CategoryInfo saveModelBuild(CategoryInfoSaveModel categoryInfoSaveModel){ + return CategoryInfo.builder() + .name(categoryInfoSaveModel.getName()) + .image(categoryInfoSaveModel.getImage()) + .start(categoryInfoSaveModel.getStart()) + .introduction(categoryInfoSaveModel.getIntroduction()) + .parentId(categoryInfoSaveModel.getParentId()) + .createBy(categoryInfoSaveModel.getCreateBy()) + .createTime(new Date()) .build(); } /** - * 修改构造器 - */ + * 修改构造器 + */ public static CategoryInfo editBuild(Long id, CategoryInfoEditReq categoryInfoEditReq){ return CategoryInfo.builder() - .id(id) + .id(id) .name(categoryInfoEditReq.getName()) .image(categoryInfoEditReq.getImage()) .start(categoryInfoEditReq.getStart()) diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java index 4c60f1b..04c1191 100644 --- a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/req/CategoryInfoSaveReq.java @@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder; import io.swagger.annotations.*; import com.muyu.common.core.web.domain.TreeEntity; +import java.util.List; + /** * 品类信息对象 category_info * @@ -49,4 +51,7 @@ public class CategoryInfoSaveReq extends TreeEntity { private String introduction; + private List attributeGroupIdList; + private List attributeIdList; + private List brandIdList; } diff --git a/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/CategoryParentCommonElementResp.java b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/CategoryParentCommonElementResp.java new file mode 100644 index 0000000..8eed615 --- /dev/null +++ b/muyu-modules/muyu-product/muyu-product-common/src/main/java/com/muyu/product/domain/resp/CategoryParentCommonElementResp.java @@ -0,0 +1,32 @@ +package com.muyu.product.domain.resp; + +import com.muyu.product.domain.AttributeGroup; +import com.muyu.product.domain.AttributeInfo; +import com.muyu.product.domain.BrandInfo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CategoryParentCommonElementResp { + + /** + * 属性集合 + */ + private List attributeInfoList; + /** + * 属性组集合 + */ + private List attributeGroupList; + /** + * 品牌集合 + */ + private List brandInfoList; + +} diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java index ec1266d..ebc4d9f 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/AttributeGroupController.java @@ -112,6 +112,7 @@ public class AttributeGroupController extends BaseController { @ApiOperation("删除属性组") @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4") public Result remove(@PathVariable List ids) { + System.out.println(); return toAjax(attributeGroupService.removeBatchByIds(ids)); } } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java index de2c0cc..f28056f 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java @@ -3,6 +3,8 @@ package com.muyu.product.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.muyu.common.security.utils.SecurityUtils; +import com.muyu.product.domain.model.CategoryInfoSaveModel; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -35,17 +37,16 @@ import com.muyu.product.service.CategoryInfoService; @RestController @RequestMapping("/category") public class CategoryInfoController extends BaseController { - @Autowired private CategoryInfoService categoryInfoService; /** * 查询品类信息列表 */ - @ApiOperation("获取品类信息") + @ApiOperation("获取品类信息列表") @RequiresPermissions("product:category:list") @GetMapping("/list") - public Result> list(CategoryInfo categoryInfo){ + public Result> list(CategoryInfo categoryInfo) { List list = categoryInfoService.list(categoryInfo); return Result.success(list); } @@ -55,7 +56,7 @@ public class CategoryInfoController extends BaseController { */ @ApiOperation("导出品类信息列表") @RequiresPermissions("product:category:export") - @Log(title = "品类信息",businessType = BusinessType.EXPORT) + @Log(title = "品类信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CategoryInfo categoryInfo) { List list = categoryInfoService.list(categoryInfo); @@ -82,7 +83,8 @@ public class CategoryInfoController extends BaseController { @PostMapping @ApiOperation("新增品类信息") public Result add(@RequestBody CategoryInfoSaveReq categoryInfoSaveReq) { - return toAjax(categoryInfoService.save(CategoryInfo.saveBuild(categoryInfoSaveReq))); + return toAjax(categoryInfoService.save( + CategoryInfoSaveModel.saveBuild(categoryInfoSaveReq, SecurityUtils::getUsername))); } /** @@ -107,4 +109,15 @@ public class CategoryInfoController extends BaseController { public Result remove(@PathVariable List ids) { return toAjax(categoryInfoService.removeBatchByIds(ids)); } + + /** + * 通过品类id查找包括父级属性集合,属性组集合以及品牌集合 + */ + @GetMapping("/parentCommonElement/{categoryId}") + @ApiOperation("通过品类id查找包括父级属性集合,属性组集合以及品牌集合") + @ApiImplicitParam(name = "categoryId", value = "categoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1") + public Result parentCommonElement(@PathVariable(value = "categoryId") Long categoryId){ + return categoryInfoService.parentCommonElement(categoryId); + } + } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/CategoryInfoService.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/CategoryInfoService.java index a52ebc1..c45abec 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/CategoryInfoService.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/CategoryInfoService.java @@ -1,8 +1,14 @@ package com.muyu.product.service; import java.util.List; + +import com.muyu.common.core.domain.Result; +import com.muyu.product.domain.AttributeGroup; +import com.muyu.product.domain.AttributeInfo; +import com.muyu.product.domain.BrandInfo; import com.muyu.product.domain.CategoryInfo; import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.product.domain.model.CategoryInfoSaveModel; /** * 品类信息Service接口 @@ -17,4 +23,27 @@ public interface CategoryInfoService extends IService { */ public List list(CategoryInfo categoryInfo); + /** + * 通过品类id查找包括父级属性集合,属性组集合,品牌集合 + */ + Result parentCommonElement(Long categoryId); + + /** + * 通过品类id获取属性组集合 + */ + List getAttributeGroupList(Long categoryId); + + /** + * 通过品类id获取属性集合 + */ + List getAttributeInfoList(Long categoryId); + + + /** + * 通过品类id获取品牌集合 + */ + List getBrandInfoList(Long categoryId); + + public boolean save(CategoryInfoSaveModel categoryInfoSaveModel); + } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeInfoServiceImpl.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeInfoServiceImpl.java index d6ede10..3899b47 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeInfoServiceImpl.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/AttributeInfoServiceImpl.java @@ -2,7 +2,6 @@ package com.muyu.product.service.impl; import java.util.ArrayList; import java.util.List; -import java.util.stream.Stream; import com.muyu.common.core.exception.ServiceException; import com.muyu.common.core.utils.ObjUtils; @@ -27,20 +26,26 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @Service public class AttributeInfoServiceImpl extends ServiceImpl implements AttributeInfoService { -// @Autowired -// private AsAttributeGroupService asAttributeGroupService; - @Autowired private AsAttributeGroupService asAttributeGroupService; + /** + * 查询商品属性列表 + * + * @param attributeInfo 商品属性 + * @return 商品属性 + */ @Override public List list(AttributeInfo attributeInfo) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if(ObjUtils.notNull(attributeInfo.getName())){ - queryWrapper.like(AttributeInfo::getName,attributeInfo.getName()); + + + if (ObjUtils.notNull(attributeInfo.getName())){ + queryWrapper.like(AttributeInfo::getName, attributeInfo.getName()); } - if(ObjUtils.notNull(attributeInfo.getCode())){ - queryWrapper.like(AttributeInfo::getCode,attributeInfo.getCode()); + + if (ObjUtils.notNull(attributeInfo.getCode())){ + queryWrapper.like(AttributeInfo::getCode, attributeInfo.getCode()); } return list(queryWrapper); @@ -48,25 +53,26 @@ public class AttributeInfoServiceImpl extends ServiceImpl attributeListByGroupId(Long groupId) { - if(groupId == null){ + public List attributeListByGroupId (Long groupId) { + if (groupId == null){ throw new ServiceException("查询商品属性组,属性组ID不可为空"); } LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(AsAttributeGroup::getGroupId,groupId); + queryWrapper.eq(AsAttributeGroup::getGroupId, groupId); List longs = asAttributeGroupService.list(queryWrapper).stream() .map(AsAttributeGroup::getAttributeId) .toList(); - System.out.println("===="+longs.toString()); - List longs1 = new ArrayList<>(); + if(longs ==null || longs.isEmpty()){ + return null; + } return this.listByIds( - asAttributeGroupService.list(queryWrapper).stream() - .map(AsAttributeGroup::getAttributeId) - .toList() + longs ); - } - } diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/CategoryInfoServiceImpl.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/CategoryInfoServiceImpl.java index 72a2e48..6148c22 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/CategoryInfoServiceImpl.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/service/impl/CategoryInfoServiceImpl.java @@ -1,13 +1,18 @@ package com.muyu.product.service.impl; +import java.util.ArrayList; import java.util.List; +import com.muyu.common.core.domain.Result; import com.muyu.common.core.utils.ObjUtils; +import com.muyu.product.domain.*; +import com.muyu.product.domain.model.CategoryInfoSaveModel; +import com.muyu.product.domain.resp.CategoryParentCommonElementResp; +import com.muyu.product.service.*; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.muyu.product.mapper.CategoryInfoMapper; -import com.muyu.product.domain.CategoryInfo; -import com.muyu.product.service.CategoryInfoService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -21,28 +26,147 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @Service public class CategoryInfoServiceImpl extends ServiceImpl implements CategoryInfoService { + @Autowired + private AsCategoryAttributeService asCategoryAttributeService; + + @Autowired + private AsCategoryAttributeGroupService asCategoryAttributeGroupService; + + @Autowired + private AsCategoryBrandService asCategoryBrandService; + + @Autowired + private AttributeInfoService attributeInfoService; + + @Autowired + private AsAttributeGroupService asAttributeGroupService; + + @Autowired + private BrandInfoService brandInfoService; + + /** - * 查询品类信息 + * 查询品类信息列表 + * + * @param categoryInfo 品类信息 + * @return 品类信息 */ @Override - public List list(CategoryInfo categoryInfo){ + public List list(CategoryInfo categoryInfo) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if(ObjUtils.notNull(categoryInfo.getName())){ - queryWrapper.like(CategoryInfo::getName,categoryInfo.getName()); + + if (ObjUtils.notNull(categoryInfo.getName())){ + queryWrapper.like(CategoryInfo::getName, categoryInfo.getName()); } - if(ObjUtils.notNull(categoryInfo.getImage())){ - queryWrapper.eq(CategoryInfo::getImage,categoryInfo.getImage()); + + if (ObjUtils.notNull(categoryInfo.getImage())){ + queryWrapper.eq(CategoryInfo::getImage, categoryInfo.getImage()); } - if(ObjUtils.notNull(categoryInfo.getParentId())){ - queryWrapper.eq(CategoryInfo::getParentId,categoryInfo.getParentId()); + + if (ObjUtils.notNull(categoryInfo.getParentId())){ + queryWrapper.eq(CategoryInfo::getParentId, categoryInfo.getParentId()); } - if(ObjUtils.notNull(categoryInfo.getStart())){ - queryWrapper.eq(CategoryInfo::getStart,categoryInfo.getStart()); + + if (ObjUtils.notNull(categoryInfo.getStart())){ + queryWrapper.eq(CategoryInfo::getStart, categoryInfo.getStart()); } - if(ObjUtils.notNull(categoryInfo.getIntroduction())){ - queryWrapper.eq(CategoryInfo::getIntroduction,categoryInfo.getIntroduction()); + + if (ObjUtils.notNull(categoryInfo.getIntroduction())){ + queryWrapper.eq(CategoryInfo::getIntroduction, categoryInfo.getIntroduction()); } + + + + + return list(queryWrapper); } + + @Override + public Result parentCommonElement(Long categoryId) { + return Result.success(CategoryParentCommonElementResp.builder() + .attributeGroupList(getAttributeGroupList(categoryId)) + .attributeInfoList(getAttributeInfoList(categoryId)) + .brandInfoList(getBrandInfoList(categoryId)) + .build()); + } + + /** + * 通过品类id获取属性组集合 + * @param categoryId + * @return 属性组集合 + */ + @Override + public List getAttributeGroupList(Long categoryId) { + return null; + } + + /** + * 通过品类id获取属性集合 + * @param categoryId + * @return 属性集合 + */ + @Override + public List getAttributeInfoList(Long categoryId) { + ArrayList attributeInfoList = new ArrayList<>(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AsCategoryAttribute::getCategoryId,categoryId); + List asCategoryAttributeList = asCategoryAttributeService.list(queryWrapper); + if (asCategoryAttributeList != null && asCategoryAttributeList.isEmpty()){ + List attributeIdList = asCategoryAttributeList.stream() + .map(AsCategoryAttribute::getAttributeId) + .toList(); + attributeInfoList.addAll(attributeInfoService.listByIds(attributeIdList)); + } + CategoryInfo categoryInfo = this.getById(categoryId); + if (categoryInfo.getParentId() !=0){ + if (attributeInfoList.isEmpty()){ + + } + } + return null; + } + + /** + * 通过品类id获取品牌集合 + * @param categoryId + * @return 品牌集合 + */ + @Override + public List getBrandInfoList(Long categoryId) { + return null; + } + + @Override + public boolean save(CategoryInfoSaveModel categoryInfoSaveModel) { + CategoryInfo categoryInfo = CategoryInfo.saveModelBuild(categoryInfoSaveModel); + boolean save = this.save(categoryInfo); + Long categoryInfoId = categoryInfo.getId(); + List attributeIdList = categoryInfoSaveModel.getAttributeIdList(); + if (attributeIdList != null && !attributeIdList.isEmpty()){ + asCategoryAttributeService.saveBatch( + attributeIdList.stream() + .map(attributeId -> AsCategoryAttribute.categoryBuild(categoryInfoId,attributeId)) + .toList() + ); + } + List attributeGroupIdList = categoryInfoSaveModel.getAttributeGroupIdList(); + if (attributeGroupIdList != null && !attributeGroupIdList.isEmpty()){ + asCategoryAttributeGroupService.saveBatch( + attributeGroupIdList.stream() + .map(attributeGrooupId -> AsCategoryAttributeGroup.categoryAttributeGroup(categoryInfoId,attributeGrooupId)) + .toList() + ); + } + List brandIdList = categoryInfoSaveModel.getBrandIdList(); + if (brandIdList != null && !brandIdList.isEmpty()){ + asCategoryBrandService.saveBatch( + brandIdList.stream() + .map(brandId -> AsCategoryBrand.categoryBrand(categoryInfoId,brandId)) + .toList() + ); + } + return save; + } }