优化菜单管理、商品分类查询节点的性能

This commit is contained in:
xwb
2020-04-30 10:32:04 +08:00
parent 8ec7c94516
commit c9ce5fffe0
2 changed files with 14 additions and 6 deletions

View File

@ -128,6 +128,7 @@ public class YxStoreCategoryServiceImpl implements YxStoreCategoryService {
YxStoreCategoryDTO categoryDTO = new YxStoreCategoryDTO();
Boolean isChild;
List<YxStoreCategory> categories = yxStoreCategoryRepository.findAll();
for (YxStoreCategoryDTO deptDTO : categoryDTOS) {
isChild = false;
if ("0".equals(deptDTO.getPid().toString())) {
@ -144,8 +145,11 @@ public class YxStoreCategoryServiceImpl implements YxStoreCategoryService {
}
if(isChild)
cates.add(deptDTO);
else if(!deptNames.contains(yxStoreCategoryRepository.findNameById(deptDTO.getPid())))
cates.add(deptDTO);
for (YxStoreCategory category : categories) {
if(category.getId()==deptDTO.getPid()&&!deptNames.contains(category.getCateName())){
cates.add(deptDTO);
}
}
}
@ -164,4 +168,4 @@ public class YxStoreCategoryServiceImpl implements YxStoreCategoryService {
return map;
//return null;
}
}
}