规格 新增

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

View File

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

View File

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

View File

@ -64,6 +64,7 @@ public class AttributeInfoController extends BaseController {
List<AttributeInfo> list = attributeInfoService.list(attributeInfo); List<AttributeInfo> list = attributeInfoService.list(attributeInfo);
ExcelUtil<AttributeInfo> util = new ExcelUtil<AttributeInfo>(AttributeInfo.class); ExcelUtil<AttributeInfo> util = new ExcelUtil<AttributeInfo>(AttributeInfo.class);
util.exportExcel(response, list, "商品属性数据"); 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.mapper.CategoryInfoMapper;
import com.muyu.product.service.*; import com.muyu.product.service.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.math3.geometry.spherical.oned.LimitAngle;
import org.springframework.beans.factory.annotation.Autowired; 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;
@ -135,30 +136,54 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
*/ */
@Override @Override
public List<AttributeGroup> getAttributeGroup (Long categoryId) { public List<AttributeGroup> getAttributeGroup (Long categoryId) {
List<AttributeGroup> attributeGroupList = new ArrayList<>(); ArrayList<AttributeGroup> attributeGroupsList = 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)); attributeGroupsList.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 (attributeGroupsList.isEmpty()){
attributeGroupList.addAll(getAttributeGroup(categoryInfo.getParentId())); attributeGroupsList.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 (attributeGroupsList.contains(attributeGroup)){
attributeGroupList.add(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;
} }
/** /**