|
@@ -88,6 +88,7 @@ public class GoodsSpecTemplateServiceImpl extends ServiceImpl<GoodsSpecTemplateM
|
|
|
lqw.eq(bo.getBusinessId() != null, GoodsSpecTemplate::getBusinessId, bo.getBusinessId());
|
|
lqw.eq(bo.getBusinessId() != null, GoodsSpecTemplate::getBusinessId, bo.getBusinessId());
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getName()), GoodsSpecTemplate::getName, bo.getName());
|
|
lqw.like(StrUtil.isNotBlank(bo.getName()), GoodsSpecTemplate::getName, bo.getName());
|
|
|
lqw.eq(bo.getStatus() != null, GoodsSpecTemplate::getStatus, bo.getStatus());
|
|
lqw.eq(bo.getStatus() != null, GoodsSpecTemplate::getStatus, bo.getStatus());
|
|
|
|
|
+ lqw.orderByDesc(GoodsSpecTemplate::getCreateTime);
|
|
|
List<GoodsSpecTemplateVo> vos = entity2Vo(this.list(lqw));
|
|
List<GoodsSpecTemplateVo> vos = entity2Vo(this.list(lqw));
|
|
|
if (CollectionUtils.isNotEmpty(vos)){
|
|
if (CollectionUtils.isNotEmpty(vos)){
|
|
|
vos.forEach(item -> {
|
|
vos.forEach(item -> {
|
|
@@ -238,33 +239,57 @@ public class GoodsSpecTemplateServiceImpl extends ServiceImpl<GoodsSpecTemplateM
|
|
|
if (CollectionUtils.isNotEmpty(specList)){
|
|
if (CollectionUtils.isNotEmpty(specList)){
|
|
|
//重新添加规格
|
|
//重新添加规格
|
|
|
Integer sort = 1;
|
|
Integer sort = 1;
|
|
|
|
|
+ //新增规格和规格值
|
|
|
for (GoodsSpecAddBo spec : specList) {
|
|
for (GoodsSpecAddBo spec : specList) {
|
|
|
- GoodsSpec goodsSpec = new GoodsSpec();
|
|
|
|
|
- BeanUtil.copyProperties(spec,goodsSpec);
|
|
|
|
|
- goodsSpec.setSpecTemplateId(bo.getSpecTemplateId());
|
|
|
|
|
- goodsSpec.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpec.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpec.setSort(sort);
|
|
|
|
|
- goodsSpecService.save(goodsSpec);
|
|
|
|
|
- spec.setSpecId(goodsSpec.getSpecId());
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(spec.getSpecAttrList())){
|
|
|
|
|
- Integer attrSortId = 1;
|
|
|
|
|
- for (GoodsSpecAttributeAddBo item : spec.getSpecAttrList()) {
|
|
|
|
|
- GoodsSpecAttribute goodsSpecAttribute = new GoodsSpecAttribute();
|
|
|
|
|
- BeanUtil.copyProperties(item, goodsSpecAttribute);
|
|
|
|
|
- goodsSpecAttribute.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpecAttribute.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpecAttribute.setSpecId(goodsSpec.getSpecId());
|
|
|
|
|
|
|
+ spec.setSpecTemplateId(bo.getSpecTemplateId());
|
|
|
|
|
+ spec.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ spec.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ spec.setSort(sort);
|
|
|
|
|
+ sort ++;
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsSpecService.saveBatchEntity(specList);
|
|
|
|
|
+ for (GoodsSpecAddBo specAddBo : specList) {
|
|
|
|
|
+ Integer attrSort = 1;//排序值
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specAddBo.getSpecAttrList())){
|
|
|
|
|
+ for (GoodsSpecAttributeAddBo item : specAddBo.getSpecAttrList()) {
|
|
|
|
|
+ item.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ item.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ item.setSpecId(specAddBo.getSpecId());
|
|
|
if (ObjectUtils.isNull(item.getSort())){
|
|
if (ObjectUtils.isNull(item.getSort())){
|
|
|
- goodsSpecAttribute.setSort(attrSortId);
|
|
|
|
|
|
|
+ item.setSort(attrSort);
|
|
|
}
|
|
}
|
|
|
- goodsSpecAttributeService.save(goodsSpecAttribute);
|
|
|
|
|
- item.setSpecAttributeId(goodsSpecAttribute.getSpecAttributeId());
|
|
|
|
|
- attrSortId ++;
|
|
|
|
|
|
|
+ attrSort ++;
|
|
|
}
|
|
}
|
|
|
|
|
+ goodsSpecAttributeService.saveBatchEntity(specAddBo.getSpecAttrList());
|
|
|
}
|
|
}
|
|
|
- sort ++;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+// for (GoodsSpecAddBo spec : specList) {
|
|
|
|
|
+// GoodsSpec goodsSpec = new GoodsSpec();
|
|
|
|
|
+// BeanUtil.copyProperties(spec,goodsSpec);
|
|
|
|
|
+// goodsSpec.setSpecTemplateId(bo.getSpecTemplateId());
|
|
|
|
|
+// goodsSpec.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+// goodsSpec.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+// goodsSpec.setSort(sort);
|
|
|
|
|
+// goodsSpecService.save(goodsSpec);
|
|
|
|
|
+// spec.setSpecId(goodsSpec.getSpecId());
|
|
|
|
|
+// if (CollectionUtils.isNotEmpty(spec.getSpecAttrList())){
|
|
|
|
|
+// Integer attrSortId = 1;
|
|
|
|
|
+// for (GoodsSpecAttributeAddBo item : spec.getSpecAttrList()) {
|
|
|
|
|
+// GoodsSpecAttribute goodsSpecAttribute = new GoodsSpecAttribute();
|
|
|
|
|
+// BeanUtil.copyProperties(item, goodsSpecAttribute);
|
|
|
|
|
+// goodsSpecAttribute.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+// goodsSpecAttribute.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+// goodsSpecAttribute.setSpecId(goodsSpec.getSpecId());
|
|
|
|
|
+// if (ObjectUtils.isNull(item.getSort())){
|
|
|
|
|
+// goodsSpecAttribute.setSort(attrSortId);
|
|
|
|
|
+// }
|
|
|
|
|
+// goodsSpecAttributeService.save(goodsSpecAttribute);
|
|
|
|
|
+// item.setSpecAttributeId(goodsSpecAttribute.getSpecAttributeId());
|
|
|
|
|
+// attrSortId ++;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// sort ++;
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -318,31 +343,27 @@ public class GoodsSpecTemplateServiceImpl extends ServiceImpl<GoodsSpecTemplateM
|
|
|
Integer sort = 1;//排序值
|
|
Integer sort = 1;//排序值
|
|
|
//新增规格和规格值
|
|
//新增规格和规格值
|
|
|
for (GoodsSpecAddBo bo : bos) {
|
|
for (GoodsSpecAddBo bo : bos) {
|
|
|
- GoodsSpec goodsSpec = new GoodsSpec();
|
|
|
|
|
- BeanUtil.copyProperties(bo,goodsSpec);
|
|
|
|
|
- goodsSpec.setSpecTemplateId(goodsSpecTemplate.getSpecTemplateId());
|
|
|
|
|
- goodsSpec.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpec.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpec.setSort(sort);
|
|
|
|
|
- goodsSpecService.save(goodsSpec);
|
|
|
|
|
- bo.setSpecId(goodsSpec.getSpecId());
|
|
|
|
|
|
|
+ bo.setSpecTemplateId(goodsSpecTemplate.getSpecTemplateId());
|
|
|
|
|
+ bo.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ bo.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ bo.setSort(sort);
|
|
|
|
|
+ sort ++;
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsSpecService.saveBatchEntity(bos);
|
|
|
|
|
+ for (GoodsSpecAddBo specAddBo : bos) {
|
|
|
Integer attrSort = 1;//排序值
|
|
Integer attrSort = 1;//排序值
|
|
|
- if (CollectionUtils.isNotEmpty(bo.getSpecAttrList())){
|
|
|
|
|
- for (GoodsSpecAttributeAddBo item : bo.getSpecAttrList()) {
|
|
|
|
|
- GoodsSpecAttribute goodsSpecAttribute = new GoodsSpecAttribute();
|
|
|
|
|
- BeanUtil.copyProperties(item, goodsSpecAttribute);
|
|
|
|
|
- goodsSpecAttribute.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpecAttribute.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
- goodsSpecAttribute.setSpecId(goodsSpec.getSpecId());
|
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specAddBo.getSpecAttrList())){
|
|
|
|
|
+ for (GoodsSpecAttributeAddBo item : specAddBo.getSpecAttrList()) {
|
|
|
|
|
+ item.setCreateTime(DateUtils.getNowTime());
|
|
|
|
|
+ item.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ item.setSpecId(specAddBo.getSpecId());
|
|
|
if (ObjectUtils.isNull(item.getSort())){
|
|
if (ObjectUtils.isNull(item.getSort())){
|
|
|
item.setSort(attrSort);
|
|
item.setSort(attrSort);
|
|
|
}
|
|
}
|
|
|
- goodsSpecAttributeService.save(goodsSpecAttribute);
|
|
|
|
|
- item.setSpecAttributeId(goodsSpecAttribute.getSpecAttributeId());
|
|
|
|
|
attrSort ++;
|
|
attrSort ++;
|
|
|
}
|
|
}
|
|
|
|
|
+ goodsSpecAttributeService.saveBatchEntity(specAddBo.getSpecAttrList());
|
|
|
}
|
|
}
|
|
|
- sort ++;
|
|
|
|
|
}
|
|
}
|
|
|
specAttrRelList = new ArrayList<>();
|
|
specAttrRelList = new ArrayList<>();
|
|
|
//组装规格属性列表
|
|
//组装规格属性列表
|