From 5d65c895b9946c4fd7dffc2d76fc3f1fc552f7b4 Mon Sep 17 00:00:00 2001 From: jjLv <1981429112@qq.com> Date: Tue, 27 May 2025 17:25:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9F=E5=A0=82=EF=BC=9A=E8=90=A5=E5=85=BB?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=9B=B4=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cook/service/impl/CookNutritionTypeServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java index e20f1bb..cef73b5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookNutritionTypeServiceImpl.java @@ -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());