规格添加
parent
b91dca8eba
commit
034c7a1b05
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -28,12 +29,12 @@ spring:
|
||||||
eager: true
|
eager: true
|
||||||
transport:
|
transport:
|
||||||
# 控制台地址
|
# 控制台地址
|
||||||
dashboard: 127.0.0.1:8718
|
dashboard: 115.159.211.196:8718
|
||||||
# nacos配置持久化
|
# nacos配置持久化
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.211.196:8848
|
||||||
dataId: sentinel-muyu-gateway
|
dataId: sentinel-muyu-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -52,4 +52,10 @@ public class AsAttributeGroup extends BaseEntity {
|
||||||
.attributeId(attributeId)
|
.attributeId(attributeId)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AsAttributeGroup buildGroup(Long attributeGroupId){
|
||||||
|
return AsAttributeGroup.builder()
|
||||||
|
.groupId(attributeGroupId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.product.domain.base.CategoryBase;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -25,7 +26,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
@TableName("as_category_attribute")
|
@TableName("as_category_attribute")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "AsCategoryAttribute", description = "品类属性中间")
|
@ApiModel(value = "AsCategoryAttribute", description = "品类属性中间")
|
||||||
public class AsCategoryAttribute extends BaseEntity {
|
public class AsCategoryAttribute extends BaseEntity implements CategoryBase {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -44,5 +45,20 @@ public class AsCategoryAttribute extends BaseEntity {
|
||||||
@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) {
|
||||||
|
return AsCategoryAttribute.builder()
|
||||||
|
.categoryId(categoryInfoId)
|
||||||
|
.attributeId(groupId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AsCategoryAttribute categoryAttribute(Long attributeId){
|
||||||
|
return AsCategoryAttribute.builder()
|
||||||
|
.categoryId(attributeId) // 修改此处为 categoryId
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Long getBaseId() {
|
||||||
|
return this.attributeId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.product.domain.base.CategoryBase;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -25,7 +26,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
@TableName("as_category_attribute_group")
|
@TableName("as_category_attribute_group")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "AsCategoryAttributeGroup", description = "品类属性组中间")
|
@ApiModel(value = "AsCategoryAttributeGroup", description = "品类属性组中间")
|
||||||
public class AsCategoryAttributeGroup extends BaseEntity {
|
public class AsCategoryAttributeGroup extends BaseEntity implements CategoryBase {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -44,5 +45,15 @@ public class AsCategoryAttributeGroup extends BaseEntity {
|
||||||
@ApiModelProperty(name = "属性组", value = "属性组", required = true)
|
@ApiModelProperty(name = "属性组", value = "属性组", required = true)
|
||||||
private Long attributeGroupId;
|
private Long attributeGroupId;
|
||||||
|
|
||||||
|
public static AsCategoryAttributeGroup categoryBuild(Long categoryInfoId, Long attributeGroupId) {
|
||||||
|
return AsCategoryAttributeGroup.builder()
|
||||||
|
.attributeGroupId(attributeGroupId)
|
||||||
|
.categoryId(categoryInfoId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getBaseId() {
|
||||||
|
return this.attributeGroupId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.product.domain.base.CategoryBase;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -25,7 +26,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
@TableName("as_category_brand")
|
@TableName("as_category_brand")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "AsCategoryBrand", description = "品类品牌中间")
|
@ApiModel(value = "AsCategoryBrand", description = "品类品牌中间")
|
||||||
public class AsCategoryBrand extends BaseEntity {
|
public class AsCategoryBrand extends BaseEntity implements CategoryBase {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -43,5 +44,15 @@ public class AsCategoryBrand extends BaseEntity {
|
||||||
@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) {
|
||||||
|
return AsCategoryBrand.builder()
|
||||||
|
.brandId(brandId)
|
||||||
|
.categoryId(categoryInfoId)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getBaseId() {
|
||||||
|
return this.brandId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ public class AttributeGroup extends BaseEntity {
|
||||||
@Excel(name = "状态")
|
@Excel(name = "状态")
|
||||||
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
||||||
private String states;
|
private String states;
|
||||||
|
/** 备注 */
|
||||||
|
@Excel(name = "备注")
|
||||||
|
@ApiModelProperty(name = "备注", value = "备注", required = true)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,6 +71,7 @@ public class AttributeGroup extends BaseEntity {
|
||||||
return AttributeGroup.builder()
|
return AttributeGroup.builder()
|
||||||
.name(attributeGroupSaveReq.getName())
|
.name(attributeGroupSaveReq.getName())
|
||||||
.states(attributeGroupSaveReq.getStates())
|
.states(attributeGroupSaveReq.getStates())
|
||||||
|
.remark(attributeGroupSaveReq.getRemark())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +83,7 @@ public class AttributeGroup extends BaseEntity {
|
||||||
.id(id)
|
.id(id)
|
||||||
.name(attributeGroupEditReq.getName())
|
.name(attributeGroupEditReq.getName())
|
||||||
.states(attributeGroupEditReq.getStates())
|
.states(attributeGroupEditReq.getStates())
|
||||||
|
.remark(attributeGroupEditReq.getRemark())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,4 +110,18 @@ public class BrandInfo extends BaseEntity {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static AsAttributeGroup buildGroup (Long attributeGroupId,
|
||||||
|
// Long attributeId) {
|
||||||
|
// return AsAttributeGroup.builder()
|
||||||
|
// .groupId(attributeGroupId)
|
||||||
|
// .attributeId(attributeId)
|
||||||
|
// .build();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static AsAttributeGroup buildGroup(Long attributeGroupId){
|
||||||
|
// return AsAttributeGroup.builder()
|
||||||
|
// .groupId(attributeGroupId)
|
||||||
|
// .build();
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.product.domain.req.CategoryInfoSaveReq;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -11,7 +12,6 @@ import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.product.domain.req.CategoryInfoQueryReq;
|
import com.muyu.product.domain.req.CategoryInfoQueryReq;
|
||||||
import com.muyu.product.domain.req.CategoryInfoSaveReq;
|
|
||||||
import com.muyu.product.domain.req.CategoryInfoEditReq;
|
import com.muyu.product.domain.req.CategoryInfoEditReq;
|
||||||
import com.muyu.common.core.web.domain.TreeEntity;
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
|
||||||
|
@ -56,6 +56,21 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询构造器
|
* 查询构造器
|
||||||
|
@ -72,12 +87,16 @@ public class CategoryInfo extends TreeEntity {
|
||||||
/**
|
/**
|
||||||
* 添加构造器
|
* 添加构造器
|
||||||
*/
|
*/
|
||||||
public static CategoryInfo saveBuild(CategoryInfoSaveReq categoryInfoSaveReq){
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static CategoryInfo saveModelBuild(CategoryInfoSaveReq categoryInfoQueryReq) {
|
||||||
return CategoryInfo.builder()
|
return CategoryInfo.builder()
|
||||||
.name(categoryInfoSaveReq.getName())
|
.name(categoryInfoQueryReq.getName())
|
||||||
.image(categoryInfoSaveReq.getImage())
|
.image(categoryInfoQueryReq.getImage())
|
||||||
.start(categoryInfoSaveReq.getStart())
|
.start(categoryInfoQueryReq.getStart())
|
||||||
.introduction(categoryInfoSaveReq.getIntroduction())
|
.introduction(categoryInfoQueryReq.getIntroduction())
|
||||||
|
.parentId(categoryInfoQueryReq.getParentId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -15,6 +16,9 @@ import com.muyu.product.domain.req.RuleAttrInfoSaveReq;
|
||||||
import com.muyu.product.domain.req.RuleAttrInfoEditReq;
|
import com.muyu.product.domain.req.RuleAttrInfoEditReq;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格详情对象 rule_attr_info
|
* 规格详情对象 rule_attr_info
|
||||||
*
|
*
|
||||||
|
@ -86,4 +90,13 @@ public class RuleAttrInfo extends BaseEntity {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RuleAttrInfo addMoudelBuild (RuleAttrAddModel ruleAttrAddModel, Supplier<Long> ruleId,Supplier<String> createBy){
|
||||||
|
return RuleAttrInfo.builder()
|
||||||
|
.ruleId(ruleId.get())
|
||||||
|
.name(ruleAttrAddModel.getName())
|
||||||
|
.attrValue(String.join(",",ruleAttrAddModel.getValueList()))
|
||||||
|
.createBy(createBy.get())
|
||||||
|
.createTime(new Date())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.muyu.product.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||||
|
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -15,6 +17,10 @@ import com.muyu.product.domain.req.RuleInfoSaveReq;
|
||||||
import com.muyu.product.domain.req.RuleInfoEditReq;
|
import com.muyu.product.domain.req.RuleInfoEditReq;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格对象 rule_info
|
* 商品规格对象 rule_info
|
||||||
*
|
*
|
||||||
|
@ -47,6 +53,8 @@ public class RuleInfo extends BaseEntity {
|
||||||
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询构造器
|
* 查询构造器
|
||||||
*/
|
*/
|
||||||
|
@ -78,4 +86,12 @@ public class RuleInfo extends BaseEntity {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RuleInfo addModelBuild(RuleInfoAddModel ruleInfoAddModel, Supplier<String> supplier) {
|
||||||
|
return RuleInfo.builder()
|
||||||
|
.name(ruleInfoAddModel.getName())
|
||||||
|
.status(ruleInfoAddModel.getStatus())
|
||||||
|
.createBy(supplier.get())
|
||||||
|
.createTime(new Date())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.product.domain.req;
|
package com.muyu.product.domain.req;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -33,5 +35,6 @@ public class AttributeGroupEditReq extends BaseEntity {
|
||||||
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
||||||
private String states;
|
private String states;
|
||||||
|
|
||||||
|
private List<Long> attributeIdList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ public class AttributeGroupSaveReq extends BaseEntity {
|
||||||
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
||||||
private String states;
|
private String states;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性ID集合
|
* 属性id的集合
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "属性ID集合",value = "属性ID集合",required = true)
|
@ApiModelProperty(name = "属性ID集合",value = "属性ID集合",required = true)
|
||||||
private List<Long> attributeIdList;
|
private List<Long> attributeIdList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.product.domain.req;
|
package com.muyu.product.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.product.domain.BrandInfo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -39,4 +40,5 @@ public class BrandInfoEditReq extends BaseEntity {
|
||||||
@ApiModelProperty(name = "介绍", value = "介绍")
|
@ApiModelProperty(name = "介绍", value = "介绍")
|
||||||
private String introduction;
|
private String introduction;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.web.domain.TreeEntity;
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类信息对象 category_info
|
* 品类信息对象 category_info
|
||||||
*
|
*
|
||||||
|
@ -39,4 +41,5 @@ public class CategoryInfoEditReq extends TreeEntity {
|
||||||
@ApiModelProperty(name = "介绍", value = "介绍")
|
@ApiModelProperty(name = "介绍", value = "介绍")
|
||||||
private String introduction;
|
private String introduction;
|
||||||
|
|
||||||
|
private List<Long> cateGoryIdList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.web.domain.TreeEntity;
|
import com.muyu.common.core.web.domain.TreeEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类信息对象 category_info
|
* 品类信息对象 category_info
|
||||||
*
|
*
|
||||||
|
@ -48,4 +50,17 @@ public class CategoryInfoSaveReq extends TreeEntity {
|
||||||
@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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.product.domain.req;
|
package com.muyu.product.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -8,6 +9,8 @@ import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格对象 rule_info
|
* 商品规格对象 rule_info
|
||||||
*
|
*
|
||||||
|
@ -38,4 +41,8 @@ public class RuleInfoSaveReq extends BaseEntity {
|
||||||
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
@ApiModelProperty(name = "规格状态", value = "规格状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格属性集合
|
||||||
|
*/
|
||||||
|
private List<RuleAttrAddModel> ruleAttrList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class AttributeGroupController extends BaseController {
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@ApiOperation("修改属性组")
|
@ApiOperation("修改属性组")
|
||||||
public Result<String> edit(@PathVariable Long id, @RequestBody AttributeGroupEditReq attributeGroupEditReq) {
|
public Result<String> edit(@PathVariable Long id, @RequestBody AttributeGroupEditReq attributeGroupEditReq) {
|
||||||
|
attributeGroupService.updateAsAttributGrop(attributeGroupEditReq,id);
|
||||||
return toAjax(attributeGroupService.updateById(AttributeGroup.editBuild(id,attributeGroupEditReq)));
|
return toAjax(attributeGroupService.updateById(AttributeGroup.editBuild(id,attributeGroupEditReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ public class BrandInfoController extends BaseController {
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@ApiOperation("修改品牌信息")
|
@ApiOperation("修改品牌信息")
|
||||||
public Result<String> edit(@PathVariable Long id, @RequestBody BrandInfoEditReq brandInfoEditReq) {
|
public Result<String> edit(@PathVariable Long id, @RequestBody BrandInfoEditReq brandInfoEditReq) {
|
||||||
|
brandInfoService.utilBrand(brandInfoEditReq,id);
|
||||||
return toAjax(brandInfoService.updateById(BrandInfo.editBuild(id,brandInfoEditReq)));
|
return toAjax(brandInfoService.updateById(BrandInfo.editBuild(id,brandInfoEditReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||||
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -77,7 +78,6 @@ public class CategoryInfoController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 新增品类信息
|
* 新增品类信息
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RequiresPermissions("product:category:add")
|
@RequiresPermissions("product:category:add")
|
||||||
@Log(title = "品类信息", businessType = BusinessType.INSERT)
|
@Log(title = "品类信息", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@ -96,6 +96,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.util(categoryInfoEditReq,id);
|
||||||
return toAjax(categoryInfoService.updateById(CategoryInfo.editBuild(id,categoryInfoEditReq)));
|
return toAjax(categoryInfoService.updateById(CategoryInfo.editBuild(id,categoryInfoEditReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,4 +125,6 @@ public class CategoryInfoController extends BaseController {
|
||||||
) {
|
) {
|
||||||
return Result.success(categoryInfoService.parentCommonElement(categoryId));
|
return Result.success(categoryInfoService.parentCommonElement(categoryId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ 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.muyu.product.domain.model.RuleInfoAddModel;
|
||||||
|
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -45,10 +47,10 @@ public class RuleInfoController extends BaseController {
|
||||||
@ApiOperation("获取商品规格列表")
|
@ApiOperation("获取商品规格列表")
|
||||||
@RequiresPermissions("product:rule:list")
|
@RequiresPermissions("product:rule:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<RuleInfo>> list(RuleInfoQueryReq ruleInfoQueryReq) {
|
public Result<TableDataInfo<RuleInfoResp>> list(RuleInfoQueryReq ruleInfoQueryReq) {
|
||||||
startPage();
|
startPage();
|
||||||
List<RuleInfo> list = ruleInfoService.list(RuleInfo.queryBuild(ruleInfoQueryReq));
|
TableDataInfo<RuleInfoResp> tableDataInfo = ruleInfoService.queryList(ruleInfoQueryReq);
|
||||||
return getDataTable(list);
|
return Result.success(tableDataInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +85,7 @@ public class RuleInfoController extends BaseController {
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("新增商品规格")
|
@ApiOperation("新增商品规格")
|
||||||
public Result<String> add(@RequestBody RuleInfoSaveReq ruleInfoSaveReq) {
|
public Result<String> add(@RequestBody RuleInfoSaveReq ruleInfoSaveReq) {
|
||||||
return toAjax(ruleInfoService.save(RuleInfo.saveBuild(ruleInfoSaveReq)));
|
return toAjax(ruleInfoService.save(RuleInfoAddModel.saveReqBuild(ruleInfoSaveReq)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,5 @@ public interface AsAttributeGroupService extends IService<AsAttributeGroup> {
|
||||||
*/
|
*/
|
||||||
public List<AsAttributeGroup> list(AsAttributeGroup asAttributeGroup);
|
public List<AsAttributeGroup> list(AsAttributeGroup asAttributeGroup);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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.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.resp.AttributeGroupPageResp;
|
import com.muyu.product.domain.resp.AttributeGroupPageResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,4 +40,5 @@ public interface AttributeGroupService extends IService<AttributeGroup> {
|
||||||
*/
|
*/
|
||||||
public Boolean save(AttributeGroupSaveModel attributeGroupSaveModel);
|
public Boolean save(AttributeGroupSaveModel attributeGroupSaveModel);
|
||||||
|
|
||||||
|
void updateAsAttributGrop(AttributeGroupEditReq attributeGroupEditReq, Long groupId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.product.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.muyu.product.domain.BrandInfo;
|
import com.muyu.product.domain.BrandInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.product.domain.req.BrandInfoEditReq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品牌信息Service接口
|
* 品牌信息Service接口
|
||||||
|
@ -19,4 +20,5 @@ public interface BrandInfoService extends IService<BrandInfo> {
|
||||||
*/
|
*/
|
||||||
public List<BrandInfo> list(BrandInfo brandInfo);
|
public List<BrandInfo> list(BrandInfo brandInfo);
|
||||||
|
|
||||||
|
void utilBrand(BrandInfoEditReq brandInfoEditReq, Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@ package com.muyu.product.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.muyu.product.domain.CategoryInfo;
|
import com.muyu.product.domain.CategoryInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||||
|
import com.muyu.product.domain.req.CategoryInfoEditReq;
|
||||||
|
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类信息Service接口
|
* 品类信息Service接口
|
||||||
|
@ -19,4 +22,8 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
|
||||||
*/
|
*/
|
||||||
public List<CategoryInfo> list(CategoryInfo categoryInfo);
|
public List<CategoryInfo> list(CategoryInfo categoryInfo);
|
||||||
|
|
||||||
|
CategoryParentCommonElementResp parentCommonElement(Long categoryId);
|
||||||
|
|
||||||
|
|
||||||
|
void util(CategoryInfoEditReq categoryInfoEditReq, Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
package com.muyu.product.service;
|
package com.muyu.product.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.product.domain.RuleInfo;
|
import com.muyu.product.domain.RuleInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||||
|
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||||
|
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||||
|
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格Service接口
|
* 商品规格Service接口
|
||||||
|
@ -19,4 +25,7 @@ public interface RuleInfoService extends IService<RuleInfo> {
|
||||||
*/
|
*/
|
||||||
public List<RuleInfo> list(RuleInfo ruleInfo);
|
public List<RuleInfo> list(RuleInfo ruleInfo);
|
||||||
|
|
||||||
|
public boolean save(RuleInfoAddModel ruleInfoAddModel);
|
||||||
|
|
||||||
|
TableDataInfo<RuleInfoResp> queryList(RuleInfoQueryReq ruleInfoQueryReq);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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.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.resp.AttributeGroupPageResp;
|
import com.muyu.product.domain.resp.AttributeGroupPageResp;
|
||||||
import com.muyu.product.mapper.AttributeGroupMapper;
|
import com.muyu.product.mapper.AttributeGroupMapper;
|
||||||
import com.muyu.product.service.AsAttributeGroupService;
|
import com.muyu.product.service.AsAttributeGroupService;
|
||||||
|
@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -39,6 +41,8 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
|
||||||
@Autowired
|
@Autowired
|
||||||
private AttributeInfoService attributeInfoService;
|
private AttributeInfoService attributeInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsAttributeGroupService asAttributeGroupService;
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*
|
*
|
||||||
|
@ -107,4 +111,21 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
|
||||||
);
|
);
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAsAttributGrop(AttributeGroupEditReq attributeGroupEditReq, Long groupId) {
|
||||||
|
AsAttributeGroup asAttributeGroup = AsAttributeGroup.buildGroup(groupId);
|
||||||
|
List<AsAttributeGroup> list = asAttributeGroupService.list(asAttributeGroup);
|
||||||
|
ArrayList<Long> asAttributeGroupIds = new ArrayList<>();
|
||||||
|
for (AsAttributeGroup attributeGroup : list) {
|
||||||
|
asAttributeGroupIds.add(attributeGroup.getId());
|
||||||
|
}
|
||||||
|
asAttributeGroupService.removeBatchByIds(asAttributeGroupIds);
|
||||||
|
List<Long> attributeIdList = attributeGroupEditReq.getAttributeIdList();
|
||||||
|
asAttributeGroupService.saveBatch(
|
||||||
|
attributeIdList.stream()
|
||||||
|
.map(attributeId -> AsAttributeGroup.buildGroup(groupId,attributeId))
|
||||||
|
.toList()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package com.muyu.product.service.impl;
|
package com.muyu.product.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.muyu.common.core.utils.ObjUtils;
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.product.domain.AsAttributeGroup;
|
||||||
|
import com.muyu.product.domain.req.AttributeGroupEditReq;
|
||||||
|
import com.muyu.product.domain.req.BrandInfoEditReq;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.product.mapper.BrandInfoMapper;
|
import com.muyu.product.mapper.BrandInfoMapper;
|
||||||
|
@ -52,6 +56,43 @@ public class BrandInfoServiceImpl extends ServiceImpl<BrandInfoMapper, BrandInfo
|
||||||
|
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
// @Override
|
||||||
|
// public void updateAsAttributGrop(AttributeGroupEditReq attributeGroupEditReq, Long groupId) {
|
||||||
|
// AsAttributeGroup asAttributeGroup = AsAttributeGroup.buildGroup(groupId);
|
||||||
|
// List<AsAttributeGroup> list = asAttributeGroupService.list(asAttributeGroup);
|
||||||
|
// ArrayList<Long> asAttributeGroupIds = new ArrayList<>();
|
||||||
|
// for (AsAttributeGroup attributeGroup : list) {
|
||||||
|
// asAttributeGroupIds.add(attributeGroup.getId());
|
||||||
|
// }
|
||||||
|
// asAttributeGroupService.removeBatchByIds(asAttributeGroupIds);
|
||||||
|
// List<Long> attributeIdList = attributeGroupEditReq.getAttributeIdList();
|
||||||
|
// asAttributeGroupService.saveBatch(
|
||||||
|
// attributeIdList.stream()
|
||||||
|
// .map(attributeId -> AsAttributeGroup.buildGroup(groupId,attributeId))
|
||||||
|
// .toList()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
@Override
|
||||||
|
public void utilBrand(BrandInfoEditReq brandInfoEditReq, Long id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// @Override
|
||||||
|
// public void updateAsAttributGrop(AttributeGroupEditReq attributeGroupEditReq, Long groupId) {
|
||||||
|
// AsAttributeGroup asAttributeGroup = AsAttributeGroup.buildGroup(groupId);
|
||||||
|
// List<AsAttributeGroup> list = asAttributeGroupService.list(asAttributeGroup);
|
||||||
|
// ArrayList<Long> asAttributeGroupIds = new ArrayList<>();
|
||||||
|
// for (AsAttributeGroup attributeGroup : list) {
|
||||||
|
// asAttributeGroupIds.add(attributeGroup.getId());
|
||||||
|
// }
|
||||||
|
// asAttributeGroupService.removeBatchByIds(asAttributeGroupIds);
|
||||||
|
// List<Long> attributeIdList = attributeGroupEditReq.getAttributeIdList();
|
||||||
|
// asAttributeGroupService.saveBatch(
|
||||||
|
// attributeIdList.stream()
|
||||||
|
// .map(attributeId -> AsAttributeGroup.buildGroup(groupId,attributeId))
|
||||||
|
// .toList()
|
||||||
|
// );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean save(BrandInfo entity) {
|
public boolean save(BrandInfo entity) {
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
package com.muyu.product.service.impl;
|
package com.muyu.product.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.core.utils.ObjUtils;
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import com.muyu.product.domain.*;
|
||||||
|
import com.muyu.product.domain.base.CategoryBase;
|
||||||
|
import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||||
|
import com.muyu.product.domain.req.CategoryInfoEditReq;
|
||||||
|
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
|
||||||
|
import com.muyu.product.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.product.mapper.CategoryInfoMapper;
|
import com.muyu.product.mapper.CategoryInfoMapper;
|
||||||
import com.muyu.product.domain.CategoryInfo;
|
|
||||||
import com.muyu.product.service.CategoryInfoService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类信息Service业务层处理
|
* 品类信息Service业务层处理
|
||||||
|
@ -20,7 +31,22 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, CategoryInfo> implements CategoryInfoService {
|
public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, CategoryInfo> implements CategoryInfoService {
|
||||||
|
@Autowired
|
||||||
|
private AsCategoryAttributeService asCategoryAttributeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsCategoryAttributeGroupService asCategoryAttributeGroupService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsCategoryBrandService asCategoryBrandService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AttributeInfoServiceImpl attributeInfoService;
|
||||||
|
@Autowired
|
||||||
|
private AttributeGroupService attributeGroupService;
|
||||||
|
@Autowired
|
||||||
|
private BrandInfoService brandInfoService;
|
||||||
/**
|
/**
|
||||||
* 查询品类信息列表
|
* 查询品类信息列表
|
||||||
*
|
*
|
||||||
|
@ -53,9 +79,137 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 groupId) {
|
||||||
|
List<Long> cateGoryIdList = categoryInfoEditReq.getCateGoryIdList();
|
||||||
|
|
||||||
|
// 删除现有的 AsCategoryAttribute 对象
|
||||||
|
List<AsCategoryAttribute> existingAttributes = asCategoryAttributeService.list();
|
||||||
|
List<Long> existingCategoryIds = existingAttributes.stream()
|
||||||
|
.map(AsCategoryAttribute::getCategoryId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
asCategoryAttributeService.removeBatchByIds(existingCategoryIds);
|
||||||
|
|
||||||
|
// 保存新的 AsCategoryAttribute 对象
|
||||||
|
List<AsCategoryAttribute> newAttributes = cateGoryIdList.stream()
|
||||||
|
.map(categoryId -> new AsCategoryAttribute())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
asCategoryAttributeService.saveBatch(newAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean save(CategoryInfoSaveModel categoryInfoSaveModel) {
|
||||||
|
// CategoryInfo categoryInfo = CategoryInfo.saveModelBuild(categoryInfoSaveModel);
|
||||||
|
// boolean save = this.save(categoryInfo);
|
||||||
|
// Long categoryInfoId = categoryInfo.getId();
|
||||||
|
// List<Long> attributeIdList = categoryInfoSaveModel.getAttributeIdList();
|
||||||
|
// if (attributeIdList != null && !attributeIdList.isEmpty()){
|
||||||
|
// asCategoryAttributeService.saveBatch(
|
||||||
|
// attributeIdList.stream()
|
||||||
|
// .map(attributeId -> AsCategoryAttribute.categoryBuild(categoryInfoId, attributeId))
|
||||||
|
// .toList()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// List<Long> attributeGroupIdList = categoryInfoSaveModel.getAttributeGroupIdList();
|
||||||
|
// if (attributeGroupIdList != null && !attributeGroupIdList.isEmpty()){
|
||||||
|
// asCategoryAttributeGroupService.saveBatch(
|
||||||
|
// attributeGroupIdList.stream()
|
||||||
|
// .map(attributeGroupId -> AsCategoryAttributeGroup.categoryBuild(categoryInfoId, attributeGroupId))
|
||||||
|
// .toList()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// List<Long> brandIdList = categoryInfoSaveModel.getBrandIdList();
|
||||||
|
// if (brandIdList != null && !brandIdList.isEmpty()){
|
||||||
|
// asCategoryBrandService.saveBatch(
|
||||||
|
// brandIdList.stream()
|
||||||
|
// .map(brandId -> AsCategoryBrand.categoryBuild(categoryInfoId, brandId))
|
||||||
|
// .toList()
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// return save;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public <T, AS> List<T> getCommon(Long categoryId, IService<AS> iService,
|
||||||
|
// IService<T> bsiservice) {
|
||||||
|
// List<T> list = new ArrayList<>();
|
||||||
|
// QueryWrapper<AS> asQueryWrapper = new QueryWrapper<>();
|
||||||
|
// asQueryWrapper.eq("attribute_id", categoryId);
|
||||||
|
// List<AS> asList = iService.list(asQueryWrapper);
|
||||||
|
// if (asList != null && !asList.isEmpty()) {
|
||||||
|
// List<Long> baseIdList = asList.stream().
|
||||||
|
// map(as -> {
|
||||||
|
// if (as instanceof CategoryBase categoryBase) {
|
||||||
|
// return categoryBase.getBaseId();
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// })
|
||||||
|
// .toList();
|
||||||
|
// list.addAll(bsiservice.listByIds(baseIdList));
|
||||||
|
// }
|
||||||
|
// CategoryInfo categoryInfo = this.getById(categoryId);
|
||||||
|
// if (categoryInfo.getParentId() != 0) {
|
||||||
|
// if (list.isEmpty()) {
|
||||||
|
// list.addAll(getCommon(categoryInfo.getParentId(), iService, bsiservice));
|
||||||
|
// } else {
|
||||||
|
// List<T> commonList = getCommon(categoryInfo.getParentId(), iService, bsiservice);
|
||||||
|
// commonList.forEach(common -> {
|
||||||
|
// if (!list.contains(common)) {
|
||||||
|
// list.add(common);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return list;
|
||||||
|
// }
|
||||||
|
//T和AS是泛型类参数
|
||||||
|
public <T,AS> List<T> getCommon(Long categoryId,IService<AS> iService,
|
||||||
|
IService<T> bsiervice){
|
||||||
|
//初始化并创建一个空列表
|
||||||
|
ArrayList<T> list = new ArrayList<>();
|
||||||
|
//创建查询条件
|
||||||
|
QueryWrapper<AS> asQueryWrapper = new QueryWrapper<>();
|
||||||
|
asQueryWrapper.eq("attribute_id",categoryId);
|
||||||
|
List<AS> asList = iService.list(asQueryWrapper);
|
||||||
|
if (asList!=null && !asList.isEmpty()){
|
||||||
|
List<Long> baseIdList=asList.stream().
|
||||||
|
map(as -> {
|
||||||
|
if (as instanceof CategoryBase categoryBase){
|
||||||
|
return categoryBase.getBaseId();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
list.addAll(bsiervice.listByIds(baseIdList));
|
||||||
|
|
||||||
|
}
|
||||||
|
CategoryInfo byId = this.getById(categoryId);
|
||||||
|
if (byId.getParentId()!=0){
|
||||||
|
if (list.isEmpty()){
|
||||||
|
list.addAll(getCommon(byId.getParentId(),iService,bsiervice));
|
||||||
|
}else {
|
||||||
|
List<T> commonList = getCommon(byId.getParentId(), iService, bsiervice);
|
||||||
|
commonList.forEach(common ->{
|
||||||
|
if (!list.contains(common)){
|
||||||
|
list.add(common);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
package com.muyu.product.service.impl;
|
package com.muyu.product.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.muyu.common.core.utils.ObjUtils;
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.product.domain.RuleAttrInfo;
|
||||||
|
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||||
|
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||||
|
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||||
|
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||||
|
import com.muyu.product.service.RuleAttrInfoService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.product.mapper.RuleInfoMapper;
|
import com.muyu.product.mapper.RuleInfoMapper;
|
||||||
import com.muyu.product.domain.RuleInfo;
|
import com.muyu.product.domain.RuleInfo;
|
||||||
|
@ -20,7 +33,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo> implements RuleInfoService {
|
public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo> implements RuleInfoService {
|
||||||
|
@Autowired
|
||||||
|
private RuleAttrInfoService ruleAttrInfoService;
|
||||||
/**
|
/**
|
||||||
* 查询商品规格列表
|
* 查询商品规格列表
|
||||||
*
|
*
|
||||||
|
@ -40,10 +54,34 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
||||||
queryWrapper.eq(RuleInfo::getStatus, ruleInfo.getStatus());
|
queryWrapper.eq(RuleInfo::getStatus, ruleInfo.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean save(RuleInfoAddModel ruleInfoAddModel) {
|
||||||
|
RuleInfo ruleInfo = RuleInfo.addModelBuild(ruleInfoAddModel, SystemUtils::getUserName);
|
||||||
|
boolean save = this.save(ruleInfo);
|
||||||
|
ruleAttrInfoService.saveBatch(
|
||||||
|
ruleInfoAddModel.getRuleAttrList().stream()
|
||||||
|
.map(ruleAttrAddModel ->RuleAttrInfo.addMoudelBuild(ruleAttrAddModel,ruleInfo::getId, SecurityUtils::getUsername) )
|
||||||
|
.toList()
|
||||||
|
);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<RuleInfoResp> queryList (RuleInfoQueryReq ruleInfoQueryReq) {
|
||||||
|
List<RuleInfo> list = this.list(RuleInfo.queryBuild(ruleInfoQueryReq));
|
||||||
|
List<RuleInfoResp> ruleInfoRespList = list.stream()
|
||||||
|
.map(ruleInfo -> RuleInfoResp.infoBuild(ruleInfo, ruleId -> {
|
||||||
|
LambdaQueryWrapper<RuleAttrInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(RuleAttrInfo::getRuleId, ruleId);
|
||||||
|
return ruleAttrInfoService.list(queryWrapper).stream().map(RuleAttrAddModel::infoBuild).toList();
|
||||||
|
}))
|
||||||
|
.toList();
|
||||||
|
return TableDataInfo.<RuleInfoResp>builder()
|
||||||
|
.rows(ruleInfoRespList)
|
||||||
|
.total(new PageInfo<>(list).getTotal())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -19,3 +19,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select id, name, status, remark, create_by, create_time, update_by, update_time from rule_info
|
select id, name, status, remark, create_by, create_time, update_by, update_time from rule_info
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,11 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.44.217:8848
|
server-addr: 115.159.211.196:8848
|
||||||
|
namespace: b8ace5a6-28a3-4126-b109-9b6623c58dc0
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue