Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2025-05-27 17:28:58 +08:00
commit a9088400b0
1 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService {
throw new ServiceException("营养类别名称不能为空");
}
try {
if (cookNutritionType.getParentId() == null){
if (cookNutritionType.getParentId() == null || cookNutritionType.getParentId() == 0L){
cookNutritionType.setParentId(0L);
cookNutritionType.setLevel("0");
}else{
@ -93,11 +93,11 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService {
if (StringUtils.isBlank(cookNutritionType.getNutritionTypeName())){
throw new ServiceException("营养类别名称不能为空");
}
if (cookNutritionType.getParentId() == null){
if (cookNutritionType.getParentId() == null || cookNutritionType.getParentId() == 0L){
cookNutritionType.setParentId(0L);
cookNutritionType.setLevel("1");
cookNutritionType.setLevel("0");
}else{
cookNutritionType.setLevel("2");
cookNutritionType.setLevel("1");
}
//判断名称是否重复
CookNutritionType nutritionType = cookNutritionTypeMapper.selectCookNutritionTypeByNutritionTypeName(cookNutritionType.getNutritionTypeName(),cookNutritionType.getNutritionTypeId());