|
@@ -69,23 +69,26 @@ public class CategoryServiceImpl implements CategoryService {
|
|
|
categoryMapper.insert(category);
|
|
|
|
|
|
// 全路径名称
|
|
|
-// List<CategoryRespVO> list = categoryMapper.getAllUpCategoryById(id, category.getType());
|
|
|
-// List<CategoryDO> list = categoryMapper.selectList();
|
|
|
-// String fullPathName = list.stream().map(CategoryRespVO::getCateName).collect(Collectors.joining("/"));
|
|
|
-// category.setFullPathName(fullPathName);
|
|
|
-// categoryMapper.updateById(category);
|
|
|
-
|
|
|
- if (category.getType() == 2) {
|
|
|
- CategoryExtraDO categoryExtra;
|
|
|
- if (createReqVO.getExtraInfo() == null) {
|
|
|
- categoryExtra = new CategoryExtraDO();
|
|
|
- } else {
|
|
|
- categoryExtra = BeanUtils.toBean(createReqVO.getExtraInfo(), CategoryExtraDO.class);
|
|
|
- }
|
|
|
- categoryExtra.setId(category.getId());
|
|
|
- categoryExtra.setDeleted(false);
|
|
|
- categoryExtraMapper.insert(categoryExtra);
|
|
|
+ try {
|
|
|
+ List<CategoryRespVO> list = categoryMapper.getAllUpCategoryById(id, category.getType());
|
|
|
+ String fullPathName = list.stream().map(CategoryRespVO::getCateName).collect(Collectors.joining("/"));
|
|
|
+ category.setFullPathName(fullPathName);
|
|
|
+ categoryMapper.updateById(category);
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+// if (category.getType() == 2) {
|
|
|
+// CategoryExtraDO categoryExtra;
|
|
|
+// if (createReqVO.getExtraInfo() == null) {
|
|
|
+// categoryExtra = new CategoryExtraDO();
|
|
|
+// } else {
|
|
|
+// categoryExtra = BeanUtils.toBean(createReqVO.getExtraInfo(), CategoryExtraDO.class);
|
|
|
+// }
|
|
|
+// categoryExtra.setId(category.getId());
|
|
|
+// categoryExtra.setDeleted(false);
|
|
|
+// categoryExtraMapper.insert(categoryExtra);
|
|
|
+// }
|
|
|
if (category.getType() == 1) {
|
|
|
// 将父级分类的产品移动到为当前分类下
|
|
|
categoryMapper.updateProductCategoryId(category.getId(), category.getParentId());
|
|
@@ -120,26 +123,26 @@ public class CategoryServiceImpl implements CategoryService {
|
|
|
});
|
|
|
}
|
|
|
categoryMapper.updateById(updateObj);
|
|
|
- if (updateReqVO.getType() == 2) {
|
|
|
- CategoryExtraDO categoryExtraDO = categoryExtraMapper.selectById(updateReqVO.getId());
|
|
|
- if (ObjectUtil.isEmpty(categoryExtraDO)) {
|
|
|
- categoryExtraDO = BeanUtils.toBean(updateReqVO.getExtraInfo(), CategoryExtraDO.class);
|
|
|
- categoryExtraDO.setId(updateReqVO.getId());
|
|
|
- categoryExtraDO.setDeleted(false);
|
|
|
- categoryExtraMapper.insert(categoryExtraDO);
|
|
|
- } else {
|
|
|
- if (StringUtils.equals("1", updateReqVO.getExtraInfo().getOperationType())) {
|
|
|
- updateReqVO.getExtraInfo().setId(categoryExtraDO.getId());
|
|
|
- UpdateWrapper<CategoryExtraDO> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.eq("id", categoryExtraDO.getId());
|
|
|
- updateWrapper.set("applet_products", updateReqVO.getExtraInfo().getAppletProducts());
|
|
|
- categoryExtraMapper.update(updateWrapper);
|
|
|
- } else {
|
|
|
- categoryExtraDO = BeanUtils.toBean(updateReqVO.getExtraInfo(), CategoryExtraDO.class);
|
|
|
- categoryExtraMapper.updateById(categoryExtraDO);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if (updateReqVO.getType() == 2) {
|
|
|
+// CategoryExtraDO categoryExtraDO = categoryExtraMapper.selectById(updateReqVO.getId());
|
|
|
+// if (ObjectUtil.isEmpty(categoryExtraDO)) {
|
|
|
+// categoryExtraDO = BeanUtils.toBean(updateReqVO.getExtraInfo(), CategoryExtraDO.class);
|
|
|
+// categoryExtraDO.setId(updateReqVO.getId());
|
|
|
+// categoryExtraDO.setDeleted(false);
|
|
|
+// categoryExtraMapper.insert(categoryExtraDO);
|
|
|
+// } else {
|
|
|
+// if (StringUtils.equals("1", updateReqVO.getExtraInfo().getOperationType())) {
|
|
|
+// updateReqVO.getExtraInfo().setId(categoryExtraDO.getId());
|
|
|
+// UpdateWrapper<CategoryExtraDO> updateWrapper = new UpdateWrapper<>();
|
|
|
+// updateWrapper.eq("id", categoryExtraDO.getId());
|
|
|
+// updateWrapper.set("applet_products", updateReqVO.getExtraInfo().getAppletProducts());
|
|
|
+// categoryExtraMapper.update(updateWrapper);
|
|
|
+// } else {
|
|
|
+// categoryExtraDO = BeanUtils.toBean(updateReqVO.getExtraInfo(), CategoryExtraDO.class);
|
|
|
+// categoryExtraMapper.updateById(categoryExtraDO);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
@Override
|