fix:修复新增菜谱错误的问题
This commit is contained in:
@@ -56,7 +56,8 @@ public class FoodServiceImpl implements FoodService {
|
||||
@Transactional
|
||||
public Boolean addRecipe(RecipeDto recipeDto) {
|
||||
LambdaQueryWrapper<Recipe> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (recipeMapper.exists(queryWrapper.eq(Recipe::getName, recipeDto.getName()))) {
|
||||
if (recipeMapper.exists(queryWrapper.eq(Recipe::getName, recipeDto.getName())
|
||||
.eq(Recipe::getCreateBy, StpUtil.getLoginIdAsString()))) {
|
||||
throw new CustomException("该菜谱已经存在");
|
||||
}
|
||||
|
||||
@@ -100,7 +101,8 @@ public class FoodServiceImpl implements FoodService {
|
||||
@Override
|
||||
public Boolean addRecord(RecordDto recordDto) {
|
||||
LambdaQueryWrapper<Recipe> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Recipe recipe = recipeMapper.selectOne(queryWrapper.eq(Recipe::getName, recordDto.getName()));
|
||||
Recipe recipe = recipeMapper.selectOne(queryWrapper.eq(Recipe::getName, recordDto.getName())
|
||||
.eq(Recipe::getCreateBy, StpUtil.getLoginIdAsString()));
|
||||
long recipeId;
|
||||
if (recipe == null) {
|
||||
Recipe newRecipe = new Recipe();
|
||||
|
||||
Reference in New Issue
Block a user