Compare commits
2 Commits
b9ce4ea6dc
...
509a1a95f7
Author | SHA1 | Date |
---|---|---|
|
509a1a95f7 | |
|
1b46a0f37b |
|
@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -30,7 +32,7 @@ public class AttrGroupVo {
|
||||||
private Long catelogId;
|
private Long catelogId;
|
||||||
|
|
||||||
@Schema(name = "catelogPaths", title = "分类路径")
|
@Schema(name = "catelogPaths", title = "分类路径")
|
||||||
private Long[] catelogPaths;
|
private List<Long> catelogPaths;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.mall.product.domain.vo.AttrGroupVo;
|
||||||
import com.mall.product.mapper.AttrGroupMapper;
|
import com.mall.product.mapper.AttrGroupMapper;
|
||||||
import com.mall.product.service.AttrGroupService;
|
import com.mall.product.service.AttrGroupService;
|
||||||
import com.mall.product.service.CategoryService;
|
import com.mall.product.service.CategoryService;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -27,11 +26,14 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupMapper, AttrGroupEntity> implements AttrGroupService {
|
public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupMapper, AttrGroupEntity> implements AttrGroupService {
|
||||||
|
|
||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
|
|
||||||
|
public AttrGroupServiceImpl(CategoryService categoryService) {
|
||||||
|
this.categoryService = categoryService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 属性分组 服务实现类
|
* * 属性分组 服务实现类
|
||||||
*
|
*
|
||||||
|
@ -95,8 +97,13 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupMapper, AttrGroup
|
||||||
public AttrGroupVo getAttrGroupById(Long attrGroupId) {
|
public AttrGroupVo getAttrGroupById(Long attrGroupId) {
|
||||||
AttrGroupEntity attrGroupEntity = getById(attrGroupId);
|
AttrGroupEntity attrGroupEntity = getById(attrGroupId);
|
||||||
Long catelogId = attrGroupEntity.getCatelogId();
|
Long catelogId = attrGroupEntity.getCatelogId();
|
||||||
|
|
||||||
|
// 找到后代所有的路径
|
||||||
List<Long> catelogIds = categoryService.findCatelogPath(catelogId);
|
List<Long> catelogIds = categoryService.findCatelogPath(catelogId);
|
||||||
return null;
|
|
||||||
|
AttrGroupVo attrGroupVo = new AttrGroupVo();
|
||||||
|
BeanUtils.copyProperties(attrGroupEntity, attrGroupVo);
|
||||||
|
attrGroupVo.setCatelogPaths(catelogIds);
|
||||||
|
return attrGroupVo;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue