品类的增删改查

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 * as_attribute_group
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Data @Data

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,11 +17,12 @@ import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.common.core.web.domain.TreeEntity; import com.muyu.common.core.web.domain.TreeEntity;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* category_info * category_info
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Data @Data
@ -59,20 +60,6 @@ public class CategoryInfo extends TreeEntity {
@Excel(name = "介绍") @Excel(name = "介绍")
@ApiModelProperty(name = "介绍", value = "介绍") @ApiModelProperty(name = "介绍", value = "介绍")
private String introduction; 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 * comment_info
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Data @Data

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ import java.util.function.Supplier;
/** /**
* rule_info * rule_info
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Data @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 * attribute_group
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Data @Data

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@ package com.muyu.product.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; 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.model.AttributeGroupSaveModel;
import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupPageResp;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -31,7 +32,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
/** /**
* Controller * Controller
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Api(tags = "属性组") @Api(tags = "属性组")
@ -112,6 +113,7 @@ public class AttributeGroupController extends BaseController {
@ApiOperation("删除属性组") @ApiOperation("删除属性组")
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4") @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) { 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 * Controller
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Api(tags = "商品属性") @Api(tags = "商品属性")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/** /**
* Service * Service
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Slf4j @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.common.core.web.page.TableDataInfo;
import com.muyu.product.domain.AsAttributeGroup; import com.muyu.product.domain.AsAttributeGroup;
import com.muyu.product.domain.AttributeGroup; import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.model.AttributeGroupSaveModel; import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.req.AttributeGroupEditReq; import com.muyu.product.domain.req.AttributeGroupEditReq;
import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupPageResp;
import com.muyu.product.mapper.AsAttributeGroupMapper;
import com.muyu.product.mapper.AttributeGroupMapper; import com.muyu.product.mapper.AttributeGroupMapper;
import com.muyu.product.service.AsAttributeGroupService; import com.muyu.product.service.AsAttributeGroupService;
import com.muyu.product.service.AttributeGroupService; import com.muyu.product.service.AttributeGroupService;
@ -22,13 +22,12 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.Spliterator;
import java.util.stream.Stream;
/** /**
* Service * Service
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Slf4j @Slf4j
@ -128,4 +127,16 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
.toList() .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 * Service
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Slf4j @Slf4j

View File

@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/** /**
* Service * Service
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Slf4j @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.req.CategoryInfoEditReq;
import com.muyu.product.domain.resp.CategoryCommonElementResp; import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryParentCommonElementResp; 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.mapper.CategoryInfoMapper;
import com.muyu.product.service.*; import com.muyu.product.service.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -30,7 +33,7 @@ import java.util.stream.Stream;
/** /**
* Service * Service
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Slf4j @Slf4j
@ -69,34 +72,47 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
@Override @Override
public List<CategoryInfo> list (CategoryInfo categoryInfo) { public List<CategoryInfo> list (CategoryInfo categoryInfo) {
LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>();
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.getName())) { if (ObjUtils.notNull(categoryInfo.getParentId())){
queryWrapper.like(CategoryInfo::getName, categoryInfo.getName()); queryWrapper.eq(CategoryInfo::getParentId,categoryInfo.getParentId());
} }
if (ObjUtils.notNull(categoryInfo.getImage())) { if (ObjUtils.notNull(categoryInfo.getStart())){
queryWrapper.eq(CategoryInfo::getImage, categoryInfo.getImage()); queryWrapper.eq(CategoryInfo::getStart,categoryInfo.getStart());
} }
if (ObjUtils.notNull(categoryInfo.getParentId())) { if (ObjUtils.notNull(categoryInfo.getIntroduction())){
queryWrapper.eq(CategoryInfo::getParentId, categoryInfo.getParentId()); queryWrapper.eq(CategoryInfo::getIntroduction,categoryInfo.getIntroduction());
}
if (ObjUtils.notNull(categoryInfo.getStart())) {
queryWrapper.eq(CategoryInfo::getStart, categoryInfo.getStart());
}
if (ObjUtils.notNull(categoryInfo.getIntroduction())) {
queryWrapper.eq(CategoryInfo::getIntroduction, categoryInfo.getIntroduction());
} }
return list(queryWrapper); 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 @Override
@Transactional @Transactional
public boolean save (CategoryInfoSaveModel categoryInfoSaveModel) { public boolean save (CategoryInfoSaveModel categoryInfoSaveModel) {
CategoryInfo categoryInfo = CategoryInfo.saveModelBuild(categoryInfoSaveModel); CategoryInfo categoryInfo = CategoryInfo.saveModelBuild(categoryInfoSaveModel);
boolean save = this.save(categoryInfo); boolean save = this.save(categoryInfo);
Long categoryInfoId = categoryInfo.getId(); Long categoryInfoId = categoryInfo.getId();
@ -104,7 +120,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
if (attributeIdList != null && !attributeIdList.isEmpty()) { if (attributeIdList != null && !attributeIdList.isEmpty()) {
asCategoryAttributeService.saveBatch( asCategoryAttributeService.saveBatch(
attributeIdList.stream() attributeIdList.stream()
.map(attributeId -> AsCategoryAttribute.categoryBuild(categoryInfoId, attributeId)) .map(attributeId -> AsCategoryAttribute.categoryBuildtwo(categoryInfoId,attributeId))
.toList() .toList()
); );
} }
@ -127,116 +143,111 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
return save; return save;
} }
/** // /**
* ID // * 通过品类ID获取父级以上的属性组集合
* // *
* @param categoryId ID // * @param categoryId 品类ID
* // *
* @return // * @return 父级以上的属性组集合
*/ // */
@Override // @Override
public List<AttributeGroup> getAttributeGroup (Long categoryId) { // public List<AttributeGroup> getAttributeGroup (Long categoryId) {
List<AttributeGroup> attributeGroupList = new ArrayList<>(); // List<AttributeGroup> attributeGroupList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryAttributeGroup> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<AsCategoryAttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryAttributeGroup::getCategoryId, categoryId); // queryWrapper.eq(AsCategoryAttributeGroup::getCategoryId, categoryId);
List<AsCategoryAttributeGroup> asCategoryAttributeGroupList = asCategoryAttributeGroupService.list(queryWrapper); // List<AsCategoryAttributeGroup> asCategoryAttributeGroupList = asCategoryAttributeGroupService.list(queryWrapper);
if (asCategoryAttributeGroupList != null && !asCategoryAttributeGroupList.isEmpty()) { // if (asCategoryAttributeGroupList != null && !asCategoryAttributeGroupList.isEmpty()) {
List<Long> attributeGroupIdList = asCategoryAttributeGroupList.stream() // List<Long> attributeGroupIdList = asCategoryAttributeGroupList.stream()
.map(AsCategoryAttributeGroup::getAttributeGroupId) // .map(AsCategoryAttributeGroup::getAttributeGroupId)
.toList(); // .toList();
attributeGroupList.addAll(attributeGroupService.listByIds(attributeGroupIdList)); // attributeGroupList.addAll(attributeGroupService.listByIds(attributeGroupIdList));
} // }
CategoryInfo categoryInfo = this.getById(categoryId); // CategoryInfo categoryInfo = this.getById(categoryId);
if (categoryInfo.getParentId() != 0) { // if (categoryInfo.getParentId() != 0) {
if (attributeGroupList.isEmpty()) { // if (attributeGroupList.isEmpty()) {
attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId())); // attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId()));
} else { // } else {
List<AttributeGroup> attributeGroups = getAttributeGroup(categoryInfo.getParentId()); // List<AttributeGroup> attributeGroups = getAttributeGroup(categoryInfo.getParentId());
attributeGroups.forEach(attributeGroup -> { // attributeGroups.forEach(attributeGroup -> {
if (!attributeGroupList.contains(attributeGroup)) { // if (!attributeGroupList.contains(attributeGroup)) {
attributeGroupList.add(attributeGroup); // attributeGroupList.add(attributeGroup);
} // }
}); // });
} // }
} // }
return attributeGroupList; // return attributeGroupList;
} // }
//
/** // /**
* ID // * 通过品类ID获取父级以上的品牌集合
* // *
* @param categoryId ID // * @param categoryId 品类ID
* // *
* @return // * @return 父级以上的品牌集合
*/ // */
@Override // @Override
public List<BrandInfo> getBrand (Long categoryId) { // public List<BrandInfo> getBrand (Long categoryId) {
List<BrandInfo> brandInfoList = new ArrayList<>(); // List<BrandInfo> brandInfoList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryBrand> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<AsCategoryBrand> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryBrand::getCategoryId, categoryId); // queryWrapper.eq(AsCategoryBrand::getCategoryId, categoryId);
List<AsCategoryBrand> asCategoryBrandList = asCategoryBrandService.list(queryWrapper); // List<AsCategoryBrand> asCategoryBrandList = asCategoryBrandService.list(queryWrapper);
if (asCategoryBrandList != null && !asCategoryBrandList.isEmpty()) { // if (asCategoryBrandList != null && !asCategoryBrandList.isEmpty()) {
List<Long> brandIdList = asCategoryBrandList.stream() // List<Long> brandIdList = asCategoryBrandList.stream()
.map(AsCategoryBrand::getBrandId) // .map(AsCategoryBrand::getBrandId)
.toList(); // .toList();
brandInfoList.addAll(brandInfoService.listByIds(brandIdList)); // brandInfoList.addAll(brandInfoService.listByIds(brandIdList));
} // }
CategoryInfo categoryInfo = this.getById(categoryId); // CategoryInfo categoryInfo = this.getById(categoryId);
if (categoryInfo.getParentId() != 0) { // if (categoryInfo.getParentId() != 0) {
if (brandInfoList.isEmpty()) { // if (brandInfoList.isEmpty()) {
brandInfoList.addAll(getBrand(categoryInfo.getParentId())); // brandInfoList.addAll(getBrand(categoryInfo.getParentId()));
} else { // } else {
List<BrandInfo> brandInfos = getBrand(categoryInfo.getParentId()); // List<BrandInfo> brandInfos = getBrand(categoryInfo.getParentId());
brandInfos.forEach(brandInfo -> { // brandInfos.forEach(brandInfo -> {
if (!brandInfoList.contains(brandInfo)) { // if (!brandInfoList.contains(brandInfo)) {
brandInfoList.add(brandInfo); // brandInfoList.add(brandInfo);
} // }
}); // });
} // }
//
} // }
return brandInfoList; // return brandInfoList;
} // }
//
/** // /**
* ID // * 通过品类ID获取父级以上的属性集合
* // *
* @param categoryId ID // * @param categoryId 品类ID
* // *
* @return // * @return 父级以上的属性集合
*/ // */
@Override // @Override
public List<AttributeInfo> getAttribute (Long categoryId) { // public List<AttributeInfo> getAttribute (Long categoryId) {
List<AttributeInfo> attributeInfoList = new ArrayList<>(); // List<AttributeInfo> attributeInfoList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryAttribute::getCategoryId, categoryId); // queryWrapper.eq(AsCategoryAttribute::getCategoryId, categoryId);
List<AsCategoryAttribute> asCategoryAttributeList = asCategoryAttributeService.list(queryWrapper); // List<AsCategoryAttribute> asCategoryAttributeList = asCategoryAttributeService.list(queryWrapper);
if (asCategoryAttributeList != null && !asCategoryAttributeList.isEmpty()) { // if (asCategoryAttributeList != null && !asCategoryAttributeList.isEmpty()) {
List<Long> attributeIdList = asCategoryAttributeList.stream() // List<Long> attributeIdList = asCategoryAttributeList.stream()
.map(AsCategoryAttribute::getAttributeId) // .map(AsCategoryAttribute::getAttributeId)
.toList(); // .toList();
attributeInfoList.addAll(attributeInfoService.listByIds(attributeIdList)); // attributeInfoList.addAll(attributeInfoService.listByIds(attributeIdList));
} // }
CategoryInfo categoryInfo = this.getById(categoryId); // CategoryInfo categoryInfo = this.getById(categoryId);
if (categoryInfo.getParentId() != 0) { // if (categoryInfo.getParentId() != 0) {
if (attributeInfoList.isEmpty()) { // if (attributeInfoList.isEmpty()) {
attributeInfoList.addAll(getAttribute(categoryInfo.getParentId())); // attributeInfoList.addAll(getAttribute(categoryInfo.getParentId()));
} else { // } else {
List<AttributeInfo> attributeInfos = getAttribute(categoryInfo.getParentId()); // List<AttributeInfo> attributeInfos = getAttribute(categoryInfo.getParentId());
attributeInfos.forEach(attributeInfoQuery -> { // attributeInfos.forEach(attributeInfoQuery -> {
if (!attributeInfoList.contains(attributeInfoQuery)) { // if (!attributeInfoList.contains(attributeInfoQuery)) {
attributeInfoList.add(attributeInfoQuery); // attributeInfoList.add(attributeInfoQuery);
} // }
}); // });
} // }
} // }
return attributeInfoList; // return attributeInfoList;
} // }
@Override
public CategoryParentCommonElementResp paretCoommonElement(Long categoryId) {
return null;
}
public <T, AS> List<T> getCommon (Long categoryId, IService<AS> iService, IService<T> bsiService) { 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; 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){ private void getParentIdListByCateGoryId(List<Long> parentIdList, Long cateGoryId){
if (cateGoryId.equals(0L)){ if (cateGoryId.equals(0L)){
@ -381,4 +373,82 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
.attributeList(attributeModelList) .attributeList(attributeModelList)
.build(); .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 * Service
* *
* @author DongZeLiang * @author YangLe
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Slf4j @Slf4j

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