食堂:营养信息新增修改接口更变

This commit is contained in:
jjLv 2025-05-27 17:25:44 +08:00
parent 1d4e22ca79
commit 5d65c895b9
1 changed files with 4 additions and 4 deletions

View File

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