品类的增删改查

master
rouchen 2024-03-10 21:32:37 +08:00
parent 90bcce03e0
commit 265583c5ac
105 changed files with 436 additions and 347 deletions

View File

@ -15,7 +15,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_attribute_group
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -15,7 +15,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_brand_project
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -16,7 +16,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_category_attribute
*
* @author DongZeLiang
* @author
* @date 2024-02-27
*/
@Data
@ -45,10 +45,10 @@ public class AsCategoryAttribute extends BaseEntity implements CategoryBase {
@ApiModelProperty(name = "属性id", value = "属性id", required = true)
private Long attributeId;
public static AsCategoryAttribute categoryBuild(Long groupId, Long categoryInfoId) {
public static AsCategoryAttribute categoryBuild(Long categoryInfoId, Long attributeId) {
return AsCategoryAttribute.builder()
.categoryId(categoryInfoId)
.attributeId(groupId)
.attributeId(attributeId)
.build();
}
@ -57,6 +57,15 @@ public class AsCategoryAttribute extends BaseEntity implements CategoryBase {
.categoryId(attributeId) // 修改此处为 categoryId
.build();
}
public static AsCategoryAttribute categoryBuildtwo(Long categoryInfoId, Long attributeId) {
return AsCategoryAttribute.builder()
.categoryId(categoryInfoId)
.attributeId(attributeId)
.build();
}
@Override
public Long getBaseId() {
return this.attributeId;

View File

@ -16,7 +16,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_category_attribute_group
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data
@ -52,6 +52,12 @@ public class AsCategoryAttributeGroup extends BaseEntity implements CategoryBase
.build();
}
public static AsCategoryAttributeGroup cateBuild(Long categoryId){
return AsCategoryAttributeGroup.builder()
.attributeGroupId(categoryId)
.categoryId(categoryId)
.build();
}
@Override
public Long getBaseId() {
return this.attributeGroupId;

View File

@ -16,7 +16,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_category_brand
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data
@ -44,6 +44,7 @@ public class AsCategoryBrand extends BaseEntity implements CategoryBase {
@Excel(name = "品牌id")
@ApiModelProperty(name = "品牌id", value = "品牌id", required = true)
private Long brandId;
public static AsCategoryBrand categoryBuild(Long categoryInfoId, Long brandId) {
return AsCategoryBrand.builder()
.brandId(brandId)
@ -51,6 +52,11 @@ public class AsCategoryBrand extends BaseEntity implements CategoryBase {
.build();
}
public static AsCategoryBrand categoryBrand(Long brandId){
return AsCategoryBrand.builder()
.brandId(brandId)
.build();
}
@Override
public Long getBaseId() {
return this.brandId;

View File

@ -18,7 +18,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_product_attribute_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -20,7 +20,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_group
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -21,7 +21,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -18,7 +18,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* brand_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -17,11 +17,12 @@ import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.common.core.web.domain.TreeEntity;
import java.util.Date;
import java.util.List;
/**
* category_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data
@ -59,20 +60,6 @@ public class CategoryInfo extends TreeEntity {
@Excel(name = "介绍")
@ApiModelProperty(name = "介绍", value = "介绍")
private String introduction;
//
// /**
// * 商品属性组关联ID
// */
// private List<Long> attributeGroupIdList;
// /**
// * 商品属性关联ID
// */
// private List<Long> attributeIdList;
//
// /**
// * 商品品牌组关联ID
// */
// private List<Long> brandIdList;
/**

View File

@ -18,7 +18,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -18,7 +18,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_like_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -18,7 +18,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* project_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -19,7 +19,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* SKU project_sku_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -22,7 +22,7 @@ import java.util.function.Supplier;
/**
* rule_attr_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -24,7 +24,7 @@ import java.util.function.Supplier;
/**
* rule_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -1,55 +0,0 @@
package com.muyu.product.domain.model;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.req.AttributeGroupSaveReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @author DongZl
* @description:
* @Date 2024-2-28 03:16
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AttributeGroupSaveModel extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 组名称 */
private String name;
/** 状态 */
private String states;
/**
* ID
*/
private List<Long> attributeIdList;
public static AttributeGroupSaveModel saveReqBuild (AttributeGroupSaveReq req){
return AttributeGroupSaveModel.builder()
.name(req.getName())
.states(req.getStates())
.attributeIdList(req.getAttributeIdList())
.build();
}
public AttributeGroup buildAttributeGroup () {
return AttributeGroup.builder()
.name(this.getName())
.states(this.getStates())
.build();
}
}

View File

@ -15,7 +15,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_group
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -13,7 +13,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_group
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -15,7 +15,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_group
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -13,7 +13,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -13,7 +13,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -13,7 +13,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* attribute_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -12,7 +12,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* brand_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* brand_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* brand_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -13,7 +13,7 @@ import java.util.List;
/**
* category_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data
@ -42,4 +42,19 @@ public class CategoryInfoEditReq extends TreeEntity {
private String introduction;
private List<Long> cateGoryIdList;
/**
* ID
*/
private List<Long> attributeGroupIdList;
/**
* ID
*/
private List<Long> attributeIdList;
/**
* ID
*/
private List<Long> brandIdList;
}

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.TreeEntity;
/**
* category_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -13,7 +13,7 @@ import java.util.List;
/**
* category_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_like_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_like_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* comment_like_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* project_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* project_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* project_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -12,7 +12,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* SKU project_sku_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -12,7 +12,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* SKU project_sku_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -12,7 +12,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* SKU project_sku_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* rule_attr_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* rule_attr_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* rule_attr_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* rule_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -11,7 +11,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
/**
* rule_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -14,7 +14,7 @@ import java.util.List;
/**
* rule_info
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Data

View File

@ -3,6 +3,7 @@ package com.muyu.product.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.resp.AttributeGroupPageResp;
import io.swagger.annotations.*;
@ -31,7 +32,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "属性组")
@ -112,6 +113,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<String> remove(@PathVariable List<Long> ids) {
return toAjax(attributeGroupService.removeBatchByIds(ids));
attributeGroupService.removeBatchById(ids);
return toAjax(attributeGroupService.removeBatchById(ids));
}
}

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "商品属性")

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "品牌信息")

View File

@ -1,7 +1,6 @@
package com.muyu.product.controller;
import java.util.List;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletResponse;
import com.muyu.common.security.utils.SecurityUtils;
@ -36,7 +35,7 @@ import com.muyu.product.service.CategoryInfoService;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "品类信息")
@ -113,6 +112,7 @@ public class CategoryInfoController extends BaseController {
@PutMapping("/{id}")
@ApiOperation("修改品类信息")
public Result<String> edit(@PathVariable Long id, @RequestBody CategoryInfoEditReq categoryInfoEditReq) {
categoryInfoService.utilCateGoryInfo(id,categoryInfoEditReq);
return toAjax(categoryInfoService.updateById(CategoryInfo.editBuild(id,categoryInfoEditReq)));
}
@ -125,7 +125,8 @@ public class CategoryInfoController extends BaseController {
@ApiOperation("删除品类信息")
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
public Result<String> remove(@PathVariable List<Long> ids) {
return toAjax(categoryInfoService.removeBatchByIds(ids));
categoryInfoService.removeBatchById(ids);
return toAjax(categoryInfoService.removeBatchById(ids));
}
/**
@ -135,10 +136,11 @@ public class CategoryInfoController extends BaseController {
*/
@GetMapping("/parentCommonElement/{categoryId}")
@ApiOperation("通过品类ID获取父级以上的属性集合")
@ApiImplicitParam(name = "categoryId", value = "categoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class, example = "1")
public Result<CategoryParentCommonElementResp> parentCommonElement(
@ApiImplicitParam(name = "categoryId",value = "categoryId",required = true,dataType = "Long",paramType = "path",dataTypeClass = Long.class,example = "1")
public Result<CategoryParentCommonElementResp> parentCommonElementRespResult(
@PathVariable(value = "categoryId") Long categoryId
) {
){
return Result.success(categoryInfoService.parentCommonElement(categoryId));
}
}

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "商品评论")

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "评论点赞")

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "商品信息")

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* SKUController
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "商品SKU")

View File

@ -29,7 +29,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "规格详情")

View File

@ -31,7 +31,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Api(tags = "商品规格")

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AsAttributeGroup;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsAttributeGroupMapper extends BaseMapper<AsAttributeGroup> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AsBrandProject;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsBrandProjectMapper extends BaseMapper<AsBrandProject> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AsCategoryAttributeGroup;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AsCategoryAttribute;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsCategoryAttributeMapper extends BaseMapper<AsCategoryAttribute> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AsCategoryBrand;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsCategoryBrandMapper extends BaseMapper<AsCategoryBrand> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AsProductAttributeInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsProductAttributeInfoMapper extends BaseMapper<AsProductAttributeInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AttributeGroup;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AttributeGroupMapper extends BaseMapper<AttributeGroup> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.AttributeInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AttributeInfoMapper extends BaseMapper<AttributeInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.BrandInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface BrandInfoMapper extends BaseMapper<BrandInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.CategoryInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface CategoryInfoMapper extends BaseMapper<CategoryInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.CommentInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface CommentInfoMapper extends BaseMapper<CommentInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.CommentLikeInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface CommentLikeInfoMapper extends BaseMapper<CommentLikeInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.ProjectInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.ProjectSkuInfo;
/**
* SKUMapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface ProjectSkuInfoMapper extends BaseMapper<ProjectSkuInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.RuleAttrInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface RuleAttrInfoMapper extends BaseMapper<RuleAttrInfo> {

View File

@ -7,7 +7,7 @@ import com.muyu.product.domain.RuleInfo;
/**
* Mapper
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface RuleInfoMapper extends BaseMapper<RuleInfo> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsAttributeGroupService extends IService<AsAttributeGroup> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsBrandProjectService extends IService<AsBrandProject> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsCategoryAttributeGroupService extends IService<AsCategoryAttributeGroup> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsCategoryAttributeService extends IService<AsCategoryAttribute> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsCategoryBrandService extends IService<AsCategoryBrand> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AsProductAttributeInfoService extends IService<AsProductAttributeInfo> {

View File

@ -5,15 +5,15 @@ import java.util.List;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.product.domain.AttributeGroup;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.req.AttributeGroupEditReq;
import com.muyu.product.domain.resp.AttributeGroupPageResp;
import org.apache.ibatis.annotations.Param;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AttributeGroupService extends IService<AttributeGroup> {
@ -41,4 +41,6 @@ public interface AttributeGroupService extends IService<AttributeGroup> {
public Boolean save(AttributeGroupSaveModel attributeGroupSaveModel);
void updateAsAttributGrop(AttributeGroupEditReq attributeGroupEditReq, Long groupId);
Boolean removeBatchById(List<Long> ids);
}

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface AttributeInfoService extends IService<AttributeInfo> {

View File

@ -8,7 +8,7 @@ import com.muyu.product.domain.req.BrandInfoEditReq;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface BrandInfoService extends IService<BrandInfo> {

View File

@ -15,7 +15,7 @@ import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface CategoryInfoService extends IService<CategoryInfo> {
@ -30,17 +30,16 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
CategoryParentCommonElementResp parentCommonElement(Long categoryId);
void util(CategoryInfoEditReq categoryInfoEditReq, Long id);
public boolean save(CategoryInfoSaveModel categoryInfoSaveModel);
List<AttributeGroup> getAttributeGroup(Long categoryId);
List<BrandInfo> getBrand(Long categoryId);
List<AttributeInfo> getAttribute(Long categoryId);
CategoryParentCommonElementResp paretCoommonElement(Long categoryId);
// List<AttributeGroup> getAttributeGroup(Long categoryId);
//
// List<BrandInfo> getBrand(Long categoryId);
//
// List<AttributeInfo> getAttribute(Long categoryId);
//
// CategoryParentCommonElementResp paretCoommonElement(Long categoryId);
/**
*
@ -48,4 +47,8 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
* @return
*/
CategoryCommonElementResp getTemplateAttributeByCateGoryId(Long cateGoryId);
void utilCateGoryInfo(Long id, CategoryInfoEditReq categoryInfoEditReq);
Boolean removeBatchById(List<Long> ids);
}

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface CommentInfoService extends IService<CommentInfo> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface CommentLikeInfoService extends IService<CommentLikeInfo> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface ProjectInfoService extends IService<ProjectInfo> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* SKUService
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface ProjectSkuInfoService extends IService<ProjectSkuInfo> {

View File

@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface RuleAttrInfoService extends IService<RuleAttrInfo> {

View File

@ -13,7 +13,7 @@ import com.muyu.product.domain.resp.RuleInfoResp;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
public interface RuleInfoService extends IService<RuleInfo> {

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -7,10 +7,10 @@ import com.muyu.common.core.utils.ObjUtils;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.product.domain.AsAttributeGroup;
import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.req.AttributeGroupEditReq;
import com.muyu.product.domain.resp.AttributeGroupPageResp;
import com.muyu.product.mapper.AsAttributeGroupMapper;
import com.muyu.product.mapper.AttributeGroupMapper;
import com.muyu.product.service.AsAttributeGroupService;
import com.muyu.product.service.AttributeGroupService;
@ -22,13 +22,12 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
import java.util.Spliterator;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j
@ -128,4 +127,16 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
.toList()
);
}
@Autowired
private AsAttributeGroupMapper asAttributeGroupMapper;
@Override
public Boolean removeBatchById(List<Long> ids) {
LambdaQueryWrapper<AsAttributeGroup> asAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>();
asAttributeGroupLambdaQueryWrapper.in(AsAttributeGroup::getGroupId, ids);
asAttributeGroupMapper.delete(asAttributeGroupLambdaQueryWrapper);
return null;
}
}

View File

@ -18,7 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

View File

@ -13,6 +13,9 @@ import com.muyu.product.domain.model.TemplateAttributeModel;
import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
import com.muyu.product.mapper.AsCategoryAttributeGroupMapper;
import com.muyu.product.mapper.AsCategoryAttributeMapper;
import com.muyu.product.mapper.AsCategoryBrandMapper;
import com.muyu.product.mapper.CategoryInfoMapper;
import com.muyu.product.service.*;
import lombok.extern.slf4j.Slf4j;
@ -30,7 +33,7 @@ import java.util.stream.Stream;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j
@ -69,34 +72,47 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
@Override
public List<CategoryInfo> list (CategoryInfo categoryInfo) {
LambdaQueryWrapper<CategoryInfo> 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);
}
/**
*
* @param categoryId ID
* @return ..
*/
@Override //通过品类ID获取父级以上的属性,属性组,品牌集
public CategoryParentCommonElementResp parentCommonElement(Long categoryId) {
return CategoryParentCommonElementResp.builder()
.attributeInfoList(getCommon(categoryId,asCategoryAttributeService,attributeInfoService))
.attributeGroupList(getCommon(categoryId,asCategoryAttributeGroupService,attributeGroupService))
.brandInfoList(getCommon(categoryId,asCategoryBrandService,brandInfoService))
.build();
}
@Override
@Transactional
public boolean save (CategoryInfoSaveModel categoryInfoSaveModel) {
CategoryInfo categoryInfo = CategoryInfo.saveModelBuild(categoryInfoSaveModel);
boolean save = this.save(categoryInfo);
Long categoryInfoId = categoryInfo.getId();
@ -104,7 +120,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
if (attributeIdList != null && !attributeIdList.isEmpty()) {
asCategoryAttributeService.saveBatch(
attributeIdList.stream()
.map(attributeId -> AsCategoryAttribute.categoryBuild(categoryInfoId, attributeId))
.map(attributeId -> AsCategoryAttribute.categoryBuildtwo(categoryInfoId,attributeId))
.toList()
);
}
@ -127,116 +143,111 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
return save;
}
/**
* ID
*
* @param categoryId ID
*
* @return
*/
@Override
public List<AttributeGroup> getAttributeGroup (Long categoryId) {
List<AttributeGroup> attributeGroupList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryAttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryAttributeGroup::getCategoryId, categoryId);
List<AsCategoryAttributeGroup> asCategoryAttributeGroupList = asCategoryAttributeGroupService.list(queryWrapper);
if (asCategoryAttributeGroupList != null && !asCategoryAttributeGroupList.isEmpty()) {
List<Long> attributeGroupIdList = asCategoryAttributeGroupList.stream()
.map(AsCategoryAttributeGroup::getAttributeGroupId)
.toList();
attributeGroupList.addAll(attributeGroupService.listByIds(attributeGroupIdList));
}
CategoryInfo categoryInfo = this.getById(categoryId);
if (categoryInfo.getParentId() != 0) {
if (attributeGroupList.isEmpty()) {
attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId()));
} else {
List<AttributeGroup> attributeGroups = getAttributeGroup(categoryInfo.getParentId());
attributeGroups.forEach(attributeGroup -> {
if (!attributeGroupList.contains(attributeGroup)) {
attributeGroupList.add(attributeGroup);
}
});
}
}
return attributeGroupList;
}
/**
* ID
*
* @param categoryId ID
*
* @return
*/
@Override
public List<BrandInfo> getBrand (Long categoryId) {
List<BrandInfo> brandInfoList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryBrand> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryBrand::getCategoryId, categoryId);
List<AsCategoryBrand> asCategoryBrandList = asCategoryBrandService.list(queryWrapper);
if (asCategoryBrandList != null && !asCategoryBrandList.isEmpty()) {
List<Long> brandIdList = asCategoryBrandList.stream()
.map(AsCategoryBrand::getBrandId)
.toList();
brandInfoList.addAll(brandInfoService.listByIds(brandIdList));
}
CategoryInfo categoryInfo = this.getById(categoryId);
if (categoryInfo.getParentId() != 0) {
if (brandInfoList.isEmpty()) {
brandInfoList.addAll(getBrand(categoryInfo.getParentId()));
} else {
List<BrandInfo> brandInfos = getBrand(categoryInfo.getParentId());
brandInfos.forEach(brandInfo -> {
if (!brandInfoList.contains(brandInfo)) {
brandInfoList.add(brandInfo);
}
});
}
}
return brandInfoList;
}
/**
* ID
*
* @param categoryId ID
*
* @return
*/
@Override
public List<AttributeInfo> getAttribute (Long categoryId) {
List<AttributeInfo> attributeInfoList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryAttribute::getCategoryId, categoryId);
List<AsCategoryAttribute> asCategoryAttributeList = asCategoryAttributeService.list(queryWrapper);
if (asCategoryAttributeList != null && !asCategoryAttributeList.isEmpty()) {
List<Long> attributeIdList = asCategoryAttributeList.stream()
.map(AsCategoryAttribute::getAttributeId)
.toList();
attributeInfoList.addAll(attributeInfoService.listByIds(attributeIdList));
}
CategoryInfo categoryInfo = this.getById(categoryId);
if (categoryInfo.getParentId() != 0) {
if (attributeInfoList.isEmpty()) {
attributeInfoList.addAll(getAttribute(categoryInfo.getParentId()));
} else {
List<AttributeInfo> attributeInfos = getAttribute(categoryInfo.getParentId());
attributeInfos.forEach(attributeInfoQuery -> {
if (!attributeInfoList.contains(attributeInfoQuery)) {
attributeInfoList.add(attributeInfoQuery);
}
});
}
}
return attributeInfoList;
}
@Override
public CategoryParentCommonElementResp paretCoommonElement(Long categoryId) {
return null;
}
// /**
// * 通过品类ID获取父级以上的属性组集合
// *
// * @param categoryId 品类ID
// *
// * @return 父级以上的属性组集合
// */
// @Override
// public List<AttributeGroup> getAttributeGroup (Long categoryId) {
// List<AttributeGroup> attributeGroupList = new ArrayList<>();
// LambdaQueryWrapper<AsCategoryAttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(AsCategoryAttributeGroup::getCategoryId, categoryId);
// List<AsCategoryAttributeGroup> asCategoryAttributeGroupList = asCategoryAttributeGroupService.list(queryWrapper);
// if (asCategoryAttributeGroupList != null && !asCategoryAttributeGroupList.isEmpty()) {
// List<Long> attributeGroupIdList = asCategoryAttributeGroupList.stream()
// .map(AsCategoryAttributeGroup::getAttributeGroupId)
// .toList();
// attributeGroupList.addAll(attributeGroupService.listByIds(attributeGroupIdList));
// }
// CategoryInfo categoryInfo = this.getById(categoryId);
// if (categoryInfo.getParentId() != 0) {
// if (attributeGroupList.isEmpty()) {
// attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId()));
// } else {
// List<AttributeGroup> attributeGroups = getAttributeGroup(categoryInfo.getParentId());
// attributeGroups.forEach(attributeGroup -> {
// if (!attributeGroupList.contains(attributeGroup)) {
// attributeGroupList.add(attributeGroup);
// }
// });
// }
// }
// return attributeGroupList;
// }
//
// /**
// * 通过品类ID获取父级以上的品牌集合
// *
// * @param categoryId 品类ID
// *
// * @return 父级以上的品牌集合
// */
// @Override
// public List<BrandInfo> getBrand (Long categoryId) {
// List<BrandInfo> brandInfoList = new ArrayList<>();
// LambdaQueryWrapper<AsCategoryBrand> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(AsCategoryBrand::getCategoryId, categoryId);
// List<AsCategoryBrand> asCategoryBrandList = asCategoryBrandService.list(queryWrapper);
// if (asCategoryBrandList != null && !asCategoryBrandList.isEmpty()) {
// List<Long> brandIdList = asCategoryBrandList.stream()
// .map(AsCategoryBrand::getBrandId)
// .toList();
// brandInfoList.addAll(brandInfoService.listByIds(brandIdList));
// }
// CategoryInfo categoryInfo = this.getById(categoryId);
// if (categoryInfo.getParentId() != 0) {
// if (brandInfoList.isEmpty()) {
// brandInfoList.addAll(getBrand(categoryInfo.getParentId()));
// } else {
// List<BrandInfo> brandInfos = getBrand(categoryInfo.getParentId());
// brandInfos.forEach(brandInfo -> {
// if (!brandInfoList.contains(brandInfo)) {
// brandInfoList.add(brandInfo);
// }
// });
// }
//
// }
// return brandInfoList;
// }
//
// /**
// * 通过品类ID获取父级以上的属性集合
// *
// * @param categoryId 品类ID
// *
// * @return 父级以上的属性集合
// */
// @Override
// public List<AttributeInfo> getAttribute (Long categoryId) {
// List<AttributeInfo> attributeInfoList = new ArrayList<>();
// LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(AsCategoryAttribute::getCategoryId, categoryId);
// List<AsCategoryAttribute> asCategoryAttributeList = asCategoryAttributeService.list(queryWrapper);
// if (asCategoryAttributeList != null && !asCategoryAttributeList.isEmpty()) {
// List<Long> attributeIdList = asCategoryAttributeList.stream()
// .map(AsCategoryAttribute::getAttributeId)
// .toList();
// attributeInfoList.addAll(attributeInfoService.listByIds(attributeIdList));
// }
// CategoryInfo categoryInfo = this.getById(categoryId);
// if (categoryInfo.getParentId() != 0) {
// if (attributeInfoList.isEmpty()) {
// attributeInfoList.addAll(getAttribute(categoryInfo.getParentId()));
// } else {
// List<AttributeInfo> attributeInfos = getAttribute(categoryInfo.getParentId());
// attributeInfos.forEach(attributeInfoQuery -> {
// if (!attributeInfoList.contains(attributeInfoQuery)) {
// attributeInfoList.add(attributeInfoQuery);
// }
// });
// }
// }
// return attributeInfoList;
// }
public <T, AS> List<T> getCommon (Long categoryId, IService<AS> iService, IService<T> bsiService) {
@ -271,26 +282,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
return list;
}
/**
* ID
*
* @param categoryId ID
*
* @return
*/
@Override
public CategoryParentCommonElementResp parentCommonElement (Long categoryId) {
return CategoryParentCommonElementResp.builder()
.attributeInfoList(getCommon(categoryId, asCategoryAttributeService, attributeInfoService))
.attributeGroupList(getCommon(categoryId, asCategoryAttributeGroupService, attributeGroupService))
.brandInfoList(getCommon(categoryId, asCategoryBrandService, brandInfoService))
.build();
}
@Override
public void util(CategoryInfoEditReq categoryInfoEditReq, Long id) {
}
private void getParentIdListByCateGoryId(List<Long> parentIdList, Long cateGoryId){
if (cateGoryId.equals(0L)){
@ -381,4 +373,82 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
.attributeList(attributeModelList)
.build();
}
@Override
public void utilCateGoryInfo(Long id, CategoryInfoEditReq categoryInfoEditReq) {
//品类 属性组
//品牌
// 属性
AsCategoryAttribute asCategoryAttributeGroup = AsCategoryAttribute.categoryAttribute(id);
List<AsCategoryAttribute> list = asCategoryAttributeService.list(asCategoryAttributeGroup);
ArrayList<Long> longs = new ArrayList<>();
for (AsCategoryAttribute asCategoryAttribute : list) {
longs.add(asCategoryAttribute.getId());
}
asCategoryAttributeService.removeBatchByIds(longs);
List<Long> attributeGroupIdList = categoryInfoEditReq.getAttributeGroupIdList();
asCategoryAttributeService.saveBatch(
attributeGroupIdList.stream()
.map(aLong -> AsCategoryAttribute.categoryBuild(id,aLong))
.toList()
);
AsCategoryAttributeGroup asCategoryAttribute = AsCategoryAttributeGroup.cateBuild(id);
List<AsCategoryAttributeGroup> categoryAttributeGroupList = asCategoryAttributeGroupService.list(asCategoryAttribute);
ArrayList<Long> arrayList = new ArrayList<>();
for (AsCategoryAttributeGroup categoryAttributeGroup : categoryAttributeGroupList) {
arrayList.add(categoryAttributeGroup.getId());
}
asCategoryAttributeGroupService.removeBatchByIds(arrayList);
List<Long> reqAttributeGroupIdList = categoryInfoEditReq.getAttributeGroupIdList();
asCategoryAttributeGroupService.saveBatch(
reqAttributeGroupIdList.stream()
.map(aLong ->
AsCategoryAttributeGroup.categoryBuild(id,aLong)
).toList()
);
AsCategoryBrand asCategoryBrand = AsCategoryBrand.categoryBrand(id);
List<AsCategoryBrand> asCategoryBrands = asCategoryBrandService.list(asCategoryBrand);
ArrayList<Long> longArrayList = new ArrayList<>();
for (AsCategoryBrand categoryBrand : asCategoryBrands) {
longArrayList.add(categoryBrand.getId());
}
asCategoryBrandService.removeBatchByIds(longArrayList);
List<Long> brandIdList = categoryInfoEditReq.getBrandIdList();
asCategoryBrandService.saveBatch(
brandIdList.stream()
.map(aLong ->
AsCategoryBrand.categoryBuild(id,aLong))
.toList()
);
}
@Autowired
private AsCategoryAttributeGroupMapper asCategoryAttributeGroupMapper;
@Autowired
private AsCategoryAttributeMapper asCategoryAttributeMapper;
@Autowired
private AsCategoryBrandMapper asCategoryBrandMapper;
@Override
public Boolean removeBatchById(List<Long> ids) {
//删除品类属性组中间表
LambdaQueryWrapper<AsCategoryAttributeGroup> asCategoryAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>();
asCategoryAttributeGroupLambdaQueryWrapper.in(AsCategoryAttributeGroup::getAttributeGroupId, ids);
asCategoryAttributeGroupMapper.delete(asCategoryAttributeGroupLambdaQueryWrapper);
//删除品类属性中间表
LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(AsCategoryAttribute::getAttributeId, ids);
asCategoryAttributeMapper.delete(queryWrapper);
//删除品类品牌中间
LambdaQueryWrapper<AsCategoryBrand> brandLambdaQueryWrapper = new LambdaQueryWrapper<>();
brandLambdaQueryWrapper.in(AsCategoryBrand::getBrandId, ids);
asCategoryBrandMapper.delete(brandLambdaQueryWrapper);
return true;
}
}

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @author YangLe
* @date 2024-02-27
*/
@Slf4j

Some files were not shown because too many files have changed in this diff Show More