规格 新增

master
hbr 2024-03-09 16:34:15 +08:00
parent 0b98947165
commit 8b3d4f9f21
5 changed files with 45 additions and 12 deletions

View File

@ -56,6 +56,7 @@ public class AttributeInfo extends BaseEntity {
.id(this.getId())
.code(this.getCode())
.name(this.getName())
.remark(this.getRemark())
.build();
}
@ -66,6 +67,7 @@ public class AttributeInfo extends BaseEntity {
return AttributeInfo.builder()
.name(attributeInfoQueryReq.getName())
.code(attributeInfoQueryReq.getCode())
.remark(attributeInfoQueryReq.getRemark())
.build();
}
@ -76,6 +78,7 @@ public class AttributeInfo extends BaseEntity {
return AttributeInfo.builder()
.name(attributeInfoSaveReq.getName())
.code(attributeInfoSaveReq.getCode())
.remark(attributeInfoSaveReq.getRemark())
.build();
}
@ -87,6 +90,7 @@ public class AttributeInfo extends BaseEntity {
.id(id)
.name(attributeInfoEditReq.getName())
.code(attributeInfoEditReq.getCode())
.remark(attributeInfoEditReq.getRemark())
.build();
}

View File

@ -58,6 +58,7 @@ public class RuleInfo extends BaseEntity {
return RuleInfo.builder()
.name(ruleInfoQueryReq.getName())
.status(ruleInfoQueryReq.getStatus())
.status(ruleInfoQueryReq.getStatus())
.build();
}

View File

@ -41,4 +41,6 @@ public class RuleInfoAddModel extends BaseEntity {
.ruleAttrList(req.getRuleAttrList())
.build();
}
}

View File

@ -64,6 +64,7 @@ public class AttributeInfoController extends BaseController {
List<AttributeInfo> list = attributeInfoService.list(attributeInfo);
ExcelUtil<AttributeInfo> util = new ExcelUtil<AttributeInfo>(AttributeInfo.class);
util.exportExcel(response, list, "商品属性数据");
util.exportExcel(response,list,"商品");
}
/**

View File

@ -15,6 +15,7 @@ import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
import com.muyu.product.mapper.CategoryInfoMapper;
import com.muyu.product.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.math3.geometry.spherical.oned.LimitAngle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -135,7 +136,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
*/
@Override
public List<AttributeGroup> getAttributeGroup (Long categoryId) {
List<AttributeGroup> attributeGroupList = new ArrayList<>();
ArrayList<AttributeGroup> attributeGroupsList = new ArrayList<>();
LambdaQueryWrapper<AsCategoryAttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AsCategoryAttributeGroup::getCategoryId,categoryId);
List<AsCategoryAttributeGroup> asCategoryAttributeGroupList = asCategoryAttributeGroupService.list(queryWrapper);
@ -143,22 +144,46 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
List<Long> attributeGroupIdList = asCategoryAttributeGroupList.stream()
.map(AsCategoryAttributeGroup::getAttributeGroupId)
.toList();
attributeGroupList.addAll(attributeGroupService.listByIds(attributeGroupIdList));
attributeGroupsList.addAll(attributeGroupService.listByIds(attributeGroupIdList));
}
CategoryInfo categoryInfo= this.getById(categoryId);
if (categoryInfo.getParentId()!=0){
if (attributeGroupList.isEmpty()) {
attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId()));
if (attributeGroupsList.isEmpty()){
attributeGroupsList.addAll(getAttributeGroup(categoryInfo.getParentId()));
}else{
List<AttributeGroup> attributeGroups = getAttributeGroup(categoryInfo.getParentId());
attributeGroups.forEach(attributeGroup -> {
if (!attributeGroupList.contains(attributeGroup)) {
attributeGroupList.add(attributeGroup);
if (attributeGroupsList.contains(attributeGroup)){
attributeGroupsList.add(attributeGroup);
}
});
}
}
return attributeGroupList;
// List<AttributeGroup> attributeGroupList = new ArrayList<>();
// LambdaQueryWrapper<AsCategoryAttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(AsCategoryAttributeGroup::getCategoryId, categoryId);
// List<AsCategoryAttributeGroup> asCategoryAttributeGroupList = asCategoryAttributeGroupService.list(queryWrapper);
// if (asCategoryAttributeGroupList != null && !asCategoryAttributeGroupList.isEmpty()) {
// List<Long> attributeGroupIdList = asCategoryAttributeGroupList.stream()
// .map(AsCategoryAttributeGroup::getAttributeGroupId)
// .toList();
// attributeGroupList.addAll(attributeGroupService.listByIds(attributeGroupIdList));
// }
// CategoryInfo categoryInfo = this.getById(categoryId);
// if (categoryInfo.getParentId() != 0) {
// if (attributeGroupList.isEmpty()) {
// attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId()));
// } else {
// List<AttributeGroup> attributeGroups = getAttributeGroup(categoryInfo.getParentId());
// attributeGroups.forEach(attributeGroup -> {
// if (!attributeGroupList.contains(attributeGroup)) {
// attributeGroupList.add(attributeGroup);
// }
// });
// }
// }
// return attributeGroupsList;
return attributeGroupsList;
}
/**