添加保护

This commit is contained in:
sxu 2025-06-09 06:39:54 +08:00
parent 85ddb86e6a
commit 81f11e3800
2 changed files with 5 additions and 1 deletions

View File

@ -560,6 +560,9 @@ public class CookDishesServiceImpl implements ICookDishesService {
Long userId = dishesDetailDTO.getUserId(); Long userId = dishesDetailDTO.getUserId();
if (!ObjectUtil.isNull(userId) && userId != -1L) { if (!ObjectUtil.isNull(userId) && userId != -1L) {
AppletDishesDetailVO appletDishesDetailVO = cookDishesMapper.selectDishesDetailByDishesId(dishesDetailDTO); AppletDishesDetailVO appletDishesDetailVO = cookDishesMapper.selectDishesDetailByDishesId(dishesDetailDTO);
if (Objects.isNull(appletDishesDetailVO)) {
return null;
}
Long countDishes = this.cookCollectionDishesMapper.getCountByUserIdAndDishesId(userId, inputDishesId); Long countDishes = this.cookCollectionDishesMapper.getCountByUserIdAndDishesId(userId, inputDishesId);
if (ObjectUtil.isNotNull(countDishes) && countDishes > 0L) { if (ObjectUtil.isNotNull(countDishes) && countDishes > 0L) {
appletDishesDetailVO.setIsFavorites(1); appletDishesDetailVO.setIsFavorites(1);

View File

@ -169,7 +169,8 @@ public class CookRecipeServiceH5Impl implements ICookRecipeH5Service {
recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId()); recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId());
} }
if(recipeIdList == null || recipeIdList.size() == 0){ if(recipeIdList == null || recipeIdList.size() == 0){
throw new ServiceException("本档口没有更早的历史菜谱记录"); log.error("本档口没有更早的历史菜谱记录");
return new ArrayList<>();
} }
} }