publicServerResponse<List<Integer>>selectCategoryAndChildrenById(IntegercategoryId){
Set<Category>categorySet=Sets.newHashSet();
findChildCategory(categorySet,categoryId);
List<Integer>categoryIdList=Lists.newArrayList();
if(categoryId!=null){
for(CategorycategoryItem : categorySet){
categoryIdList.add(categoryItem.getId());
}
}
returnServerResponse.createBySuccess(categoryIdList);
}
privateSet<Category>findChildCategory(Set<Category>categorySet ,IntegercategoryId){
Categorycategory=categoryMapper.selectByPrimaryKey(categoryId);
if(category!=null){
categorySet.add(category);
}
List<Category>categoryList=categoryMapper.selectCategoryChildrenByParentId(categoryId);
for(CategorycategoryItem : categoryList){
findChildCategory(categorySet,categoryItem.getId());
}
returncategorySet;
}